summaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-25 01:11:22 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-25 01:11:22 +0000
commit2c6630701996e679b15e1d495e7999c68a4b43bd (patch)
tree58a6300e6b755d51992c7ba3c862952aada55ae8 /gcc/loop.c
parent265bd3d809182a05ff8a32750e712ae8ce699b52 (diff)
downloadgcc-2c6630701996e679b15e1d495e7999c68a4b43bd.tar.gz
* rtl.h (loc_mentioned_in_p): Declare.
* reload.c (loc_mentioned_in_p): Moved from here... * rtlanal.c (loc_mentioned_in_p): to here. No longer static. Fix loop increment for 'E' handling. * loop.c (strength_reduce): When doing biv->giv conversion, take multi-insn biv increments into account. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34150 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index df3ee526a68..0c37c34036e 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -4228,6 +4228,7 @@ strength_reduce (loop, insn_count, flags)
HOST_WIDE_INT offset;
rtx set, add_val, old_reg, dest_reg, last_use_insn, note;
int old_regno, new_regno;
+ rtx next_loc_insn;
if (! v->always_executed
|| v->maybe_multiple
@@ -4262,7 +4263,17 @@ strength_reduce (loop, insn_count, flags)
VARRAY_GROW (reg_single_usage, nregs);
}
- if (! validate_change (next->insn, next->location, add_val, 0))
+ /* Some bivs are incremented with a multi-insn sequence.
+ The first insn contains the add. */
+ next_loc_insn = next->insn;
+ while (! loc_mentioned_in_p (next->location,
+ PATTERN (next_loc_insn)))
+ next_loc_insn = PREV_INSN (next_loc_insn);
+
+ if (next_loc_insn == v->insn)
+ abort ();
+
+ if (! validate_change (next_loc_insn, next->location, add_val, 0))
{
vp = &v->next_iv;
continue;
@@ -4274,7 +4285,7 @@ strength_reduce (loop, insn_count, flags)
/* Set last_use_insn so that we can check against it. */
for (last_use_insn = v->insn, p = NEXT_INSN (v->insn);
- p != next->insn;
+ p != next_loc_insn;
p = next_insn_in_loop (loop, p))
{
if (!INSN_P (p))
@@ -4294,7 +4305,7 @@ strength_reduce (loop, insn_count, flags)
|| ! validate_change (v->insn, &SET_DEST (set), dest_reg, 0))
{
/* Change the increment at NEXT back to what it was. */
- if (! validate_change (next->insn, next->location,
+ if (! validate_change (next_loc_insn, next->location,
next->add_val, 0))
abort ();
vp = &v->next_iv;
@@ -4353,7 +4364,7 @@ strength_reduce (loop, insn_count, flags)
the replaced increment and the next increment, and
remember the last insn that needed a replacement. */
for (last_use_insn = v->insn, p = NEXT_INSN (v->insn);
- p != next->insn;
+ p != next_loc_insn;
p = next_insn_in_loop (loop, p))
{
rtx note;