aboutsummaryrefslogtreecommitdiff
path: root/gcc/unroll.c
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1993-04-06 12:38:34 -0700
committerJim Wilson <wilson@gcc.gnu.org>1993-04-06 12:38:34 -0700
commit1f1e8172a80d323ea1b6f2843185a5fb2226e2ac (patch)
treeb0fbf2dc41b326863269226e959e0c282703f2ad /gcc/unroll.c
parentfdd79c58a2938ccd78e94332a102e74865d2a964 (diff)
downloadgcc-1f1e8172a80d323ea1b6f2843185a5fb2226e2ac.zip
gcc-1f1e8172a80d323ea1b6f2843185a5fb2226e2ac.tar.gz
gcc-1f1e8172a80d323ea1b6f2843185a5fb2226e2ac.tar.bz2
(loop_iterations): When computing comparison_value, use
reg_set_p to identify instructions that modify it. From-SVN: r4036
Diffstat (limited to 'gcc/unroll.c')
-rw-r--r--gcc/unroll.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/gcc/unroll.c b/gcc/unroll.c
index b58066d..d93e3ba 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;
}
}