This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: mis-preconditioning while unrolling (resubmission)
- From: Dale Johannesen <dalej at apple dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 3 Jan 2002 15:20:10 -0800
- Subject: PATCH: mis-preconditioning while unrolling (resubmission)
This fixes the problem described here:
http://gcc.gnu.org/ml/gcc-patches/2002-01/msg00122.html
A standalone test is given in PR optimization/5269.
Bootstrapped and tested on Darwin.
Index: unroll.c
===================================================================
RCS file: /cvs/Darwin/Commands/GNU/gcc/gcc/unroll.c,v
diff -u -d -b -w -c -3 -p -r1.10 unroll.c
*** unroll.c 2001/12/29 21:59:30 1.10
--- unroll.c 2002/01/02 23:45:21
*************** precondition_loop_p (loop, initial_value
*** 1392,1400 ****
--- 1392,1409 ----
if (loop_info->n_iterations > 0)
{
+ 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)