aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1999-05-24 13:43:22 +0000
committerJeff Law <law@gcc.gnu.org>1999-05-24 07:43:22 -0600
commitae188a870e40bdf711b0dc0bcaf9fa28d1d5b6f0 (patch)
tree1de1c0198ba0883933c81ac96154d948b0cbea9f
parent79d6c916407fab932d8ec86cb2cddc2a0cb781fe (diff)
downloadgcc-ae188a870e40bdf711b0dc0bcaf9fa28d1d5b6f0.zip
gcc-ae188a870e40bdf711b0dc0bcaf9fa28d1d5b6f0.tar.gz
gcc-ae188a870e40bdf711b0dc0bcaf9fa28d1d5b6f0.tar.bz2
loop.c (strength_reduce): Do not clear NOT_EVERY_ITERATION at the last CODE_LABEL in a loop if...
* loop.c (strength_reduce): Do not clear NOT_EVERY_ITERATION at the last CODE_LABEL in a loop if we have previously passed a jump to the top of the loop. From-SVN: r27125
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/loop.c23
2 files changed, 26 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5f6903d..7ff15a4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+Mon May 24 14:35:24 1999 Jeffrey A Law (law@cygnus.com)
+
+ * loop.c (strength_reduce): Do not clear NOT_EVERY_ITERATION at the
+ last CODE_LABEL in a loop if we have previously passed a jump
+ to the top of the loop.
+
Mon May 24 07:56:29 1999 Nick Clifton <nickc@cygnus.com>
* config/arm/arm.h (OUTPUT_INT_ADDR_CONST): Fix blunder made when
diff --git a/gcc/loop.c b/gcc/loop.c
index 244d939..7ee6532 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -3669,6 +3669,9 @@ strength_reduce (scan_start, end, loop_top, insn_count,
/* This is 1 if current insn may be executed more than once for every
loop iteration. */
int maybe_multiple = 0;
+ /* This is 1 if we have past a branch back to the top of the loop
+ (aka a loop latch). */
+ int past_loop_latch = 0;
/* Temporary list pointers for traversing loop_iv_list. */
struct iv_class *bl, **backbl;
/* Ratio of extra register life span we can justify
@@ -3836,16 +3839,30 @@ strength_reduce (scan_start, end, loop_top, insn_count,
loop_depth--;
}
+ /* Note if we pass a loop latch. If we do, then we can not clear
+ NOT_EVERY_ITERATION below when we pass the last CODE_LABEL in
+ a loop since a jump before the last CODE_LABEL may have started
+ a new loop iteration.
+
+ Note that LOOP_TOP is only set for rotated loops and we need
+ this check for all loops, so compare against the CODE_LABEL
+ which immediately follows LOOP_START. */
+ if (GET_CODE (p) == JUMP_INSN && JUMP_LABEL (p) == NEXT_INSN (loop_start))
+ past_loop_latch = 1;
+
/* Unlike in the code motion pass where MAYBE_NEVER indicates that
an insn may never be executed, NOT_EVERY_ITERATION indicates whether
or not an insn is known to be executed each iteration of the
loop, whether or not any iterations are known to occur.
Therefore, if we have just passed a label and have no more labels
- between here and the test insn of the loop, we know these insns
- will be executed each iteration. */
+ between here and the test insn of the loop, and we have not passed
+ a jump to the top of the loop, then we know these insns will be
+ executed each iteration. */
- if (not_every_iteration && GET_CODE (p) == CODE_LABEL
+ if (not_every_iteration
+ && ! past_loop_latch
+ && GET_CODE (p) == CODE_LABEL
&& no_labels_between_p (p, loop_end)
&& loop_insn_first_p (p, loop_cont))
not_every_iteration = 0;