diff options
author | Dale Johannesen <dalej@apple.com> | 2002-01-10 21:00:43 +0000 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2002-01-10 13:00:43 -0800 |
commit | 04894c5a9e4ee2ac250c05c2d133ca6da3aab1a7 (patch) | |
tree | 624a8515e72c68d7e88c18f4c57278fc7dd39492 | |
parent | adc9fe67ba827c1fba67ca5e1ebc7901bb156450 (diff) | |
download | gcc-04894c5a9e4ee2ac250c05c2d133ca6da3aab1a7.zip gcc-04894c5a9e4ee2ac250c05c2d133ca6da3aab1a7.tar.gz gcc-04894c5a9e4ee2ac250c05c2d133ca6da3aab1a7.tar.bz2 |
re PR rtl-optimization/5269 (loop unroller fails to pull the right number of copies out)
PR optimization/5269
* unroll.c (precondition_loop_p): Make *increment be the correct
sign when n_iterations known, to avoid confusing caller.
From-SVN: r48752
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/unroll.c | 15 |
2 files changed, 18 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 76fcfba..fbabcae 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 047e983..df02b7c 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) |