aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJ"orn Rennecke <amylaar@cygnus.co.uk>1999-03-11 13:28:55 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>1999-03-11 13:28:55 +0000
commit8e9fb571ee594a45bc9fcfb309f8669b167ae042 (patch)
tree46f9d0495caaa9b9462960a85495a05e0c7fad55 /gcc
parent3900dc09bc97e0b8a1dd4653d85072d825a1318f (diff)
downloadgcc-8e9fb571ee594a45bc9fcfb309f8669b167ae042.zip
gcc-8e9fb571ee594a45bc9fcfb309f8669b167ae042.tar.gz
gcc-8e9fb571ee594a45bc9fcfb309f8669b167ae042.tar.bz2
loop.c (strength_reduce): Don't do biv increment -> DEST_REG giv conversion if we don't know the lifetime.
* loop.c (strength_reduce): Don't do biv increment -> DEST_REG giv conversion if we don't know the lifetime. From-SVN: r25702
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/loop.c39
2 files changed, 41 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1b1aa77..ebb8f19 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Thu Mar 11 21:25:59 1999 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * loop.c (strength_reduce): Don't do biv increment -> DEST_REG giv
+ conversion if we don't know the lifetime.
+
Thu Mar 11 20:37:59 1999 J"orn Rennecke <amylaar@cygnus.co.uk>
* reload.1c (delete_address_reloads_1): Check for reloads of
diff --git a/gcc/loop.c b/gcc/loop.c
index c5666f9..a2023b2 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -4198,13 +4198,46 @@ strength_reduce (scan_start, end, loop_top, insn_count,
VARRAY_GROW (may_not_optimize, nregs);
}
- validate_change (v->insn, &SET_DEST (set), dest_reg, 1);
- validate_change (next->insn, next->location, add_val, 1);
- if (! apply_change_group ())
+ if (! validate_change (next->insn, next->location, add_val, 0))
{
vp = &v->next_iv;
continue;
}
+
+ /* Here we can try to eliminate the increment by combining
+ it into the uses. */
+
+ /* 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_insn_in_loop (p, scan_start, end, loop_top))
+ {
+ rtx note;
+
+ if (GET_RTX_CLASS (GET_CODE (p)) != 'i')
+ continue;
+ if (reg_mentioned_p (old_reg, PATTERN (p)))
+ {
+ last_use_insn = p;
+ }
+ }
+
+ /* If we can't get the LUIDs for the insns, we can't
+ calculate the lifetime. This is likely from unrolling
+ of an inner loop, so there is little point in making this
+ a DEST_REG giv anyways. */
+ if (INSN_UID (v->insn) >= max_uid_for_loop
+ || INSN_UID (last_use_insn) >= max_uid_for_loop
+ || ! 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,
+ next->add_val, 0))
+ abort ();
+ vp = &v->next_iv;
+ continue;
+ }
next->add_val = add_val;
v->dest_reg = dest_reg;
v->giv_type = DEST_REG;