summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-10 21:00:43 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-10 21:00:43 +0000
commitba26e2a7572b907bbaa8eb3fa2b22bc1dd477821 (patch)
tree624a8515e72c68d7e88c18f4c57278fc7dd39492
parent6831447b2233b6fbf9f7ee1ed4d10cfddbcdcc65 (diff)
downloadgcc-ba26e2a7572b907bbaa8eb3fa2b22bc1dd477821.tar.gz
PR optimization/5269
* unroll.c (precondition_loop_p): Make *increment be the correct sign when n_iterations known, to avoid confusing caller. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48752 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/unroll.c15
2 files changed, 18 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 76fcfbab3c1..fbabcae9f66 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2002-01-10 Dale Johannesen <dalej@apple.com>
+
+ PR optimization/5269
+ * unroll.c (precondition_loop_p): Make *increment be the correct
+ sign when n_iterations known, to avoid confusing caller.
+
2002-01-10 Kazu Hirata <kazu@hxi.com>
* doc/extend.texi (deprecated): Fix a typo.
diff --git a/gcc/unroll.c b/gcc/unroll.c
index 047e98395d7..df02b7c8cbb 100644
--- a/gcc/unroll.c
+++ b/gcc/unroll.c
@@ -1392,9 +1392,18 @@ precondition_loop_p (loop, initial_value, final_value, increment, mode)
if (loop_info->n_iterations > 0)
{
- *initial_value = const0_rtx;
- *increment = const1_rtx;
- *final_value = GEN_INT (loop_info->n_iterations);
+ if (INTVAL (loop_info->increment) > 0)
+ {
+ *initial_value = const0_rtx;
+ *increment = const1_rtx;
+ *final_value = GEN_INT (loop_info->n_iterations);
+ }
+ else
+ {
+ *initial_value = GEN_INT (loop_info->n_iterations);
+ *increment = constm1_rtx;
+ *final_value = const0_rtx;
+ }
*mode = word_mode;
if (loop_dump_stream)