aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1998-08-28 00:10:42 +0000
committerJeff Law <law@gcc.gnu.org>1998-08-27 18:10:42 -0600
commit3aa94dc884332bb8d40441cfbb7c695708a783c0 (patch)
tree1f869e9b2d08caaad6f7fa6c36b368469ed62ad6 /gcc
parent78b87d18ae25299f9da51225378397abbdbb5349 (diff)
downloadgcc-3aa94dc884332bb8d40441cfbb7c695708a783c0.zip
gcc-3aa94dc884332bb8d40441cfbb7c695708a783c0.tar.gz
gcc-3aa94dc884332bb8d40441cfbb7c695708a783c0.tar.bz2
loop.c (check_dbra_loop): The loop ending comparison value must be an invariant or we can not reverse the...
* loop.c (check_dbra_loop): The loop ending comparison value must be an invariant or we can not reverse the loop. From-SVN: r22045
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/loop.c9
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6db8cead..ae5ef3d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@
Thu Aug 27 20:10:46 1998 Jeffrey A Law (law@cygnus.com)
+ * loop.c (check_dbra_loop): The loop ending comparison value
+ must be an invariant or we can not reverse the loop.
+
* loop.c (scan_loop): Count down from max_reg_num - 1 to
FIRST_PSEUDO_REGISTER to avoid calling max_reg_num each iteration
of the loop.
diff --git a/gcc/loop.c b/gcc/loop.c
index 3301f7d..cd257be 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -6904,6 +6904,15 @@ check_dbra_loop (loop_end, insn_count, loop_start)
comparison_sign_mask
= (unsigned HOST_WIDE_INT)1 << (comparison_const_width - 1);
+ /* If the comparison value is not a loop invariant, then we
+ can not reverse this loop.
+
+ ??? If the insns which initialize the comparison value as
+ a whole compute an invariant result, then we could move
+ them out of the loop and proceed with loop reversal. */
+ if (!invariant_p (comparison_val))
+ return 0;
+
if (GET_CODE (comparison_value) == CONST_INT)
comparison_val = INTVAL (comparison_value);
initial_value = bl->initial_value;