From 1f1e8172a80d323ea1b6f2843185a5fb2226e2ac Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Tue, 6 Apr 1993 12:38:34 -0700 Subject: [PATCH] (loop_iterations): When computing comparison_value, use reg_set_p to identify instructions that modify it. From-SVN: r4036 --- gcc/unroll.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gcc/unroll.c b/gcc/unroll.c index b58066d20ca..d93e3bac95a 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -3039,14 +3039,19 @@ loop_iterations (loop_start, loop_end) break; else if (GET_RTX_CLASS (GET_CODE (insn)) == 'i' - && (set = single_set (insn)) - && (SET_DEST (set) == comparison_value)) + && reg_set_p (comparison_value, insn)) { - rtx note = find_reg_note (insn, REG_EQUAL, NULL_RTX); - - if (note && GET_CODE (XEXP (note, 0)) != EXPR_LIST) - comparison_value = XEXP (note, 0); + /* We found the last insn before the loop that sets the register. + If it sets the entire register, and has a REG_EQUAL note, + then use the value of the REG_EQUAL note. */ + if ((set = single_set (insn)) + && (SET_DEST (set) == comparison_value)) + { + rtx note = find_reg_note (insn, REG_EQUAL, NULL_RTX); + if (note && GET_CODE (XEXP (note, 0)) != EXPR_LIST) + comparison_value = XEXP (note, 0); + } break; } }