aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorJ"orn Rennecke <amylaar@cygnus.co.uk>2000-05-25 01:11:22 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>2000-05-25 02:11:22 +0100
commitdb7ba7424119d53c01667af6957ca943c0cd2ff1 (patch)
tree58a6300e6b755d51992c7ba3c862952aada55ae8 /gcc/loop.c
parent04da69d3a6eeb4b9cbd3efc5473d063577e66d58 (diff)
downloadgcc-db7ba7424119d53c01667af6957ca943c0cd2ff1.zip
gcc-db7ba7424119d53c01667af6957ca943c0cd2ff1.tar.gz
gcc-db7ba7424119d53c01667af6957ca943c0cd2ff1.tar.bz2
rtl.h (loc_mentioned_in_p): Declare.
* 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. From-SVN: r34150
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 df3ee52..0c37c34 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;