This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/7120: Run once loop should *always* be unrolled
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 26 Jun 2002 03:26:02 -0000
- Subject: Re: optimization/7120: Run once loop should *always* be unrolled
- Reply-to: Alan Modra <amodra at bigpond dot net dot au>
The following reply was made to PR optimization/7120; it has been noted by GNATS.
From: Alan Modra <amodra@bigpond.net.au>
To: davem@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
nobody@gcc.gnu.org, rth@twiddle.net, rusty@rustcorp.com.au,
gcc-gnats@gcc.gnu.org
Cc: gcc-patches@gcc.gnu.org
Subject: Re: optimization/7120: Run once loop should *always* be unrolled
Date: Wed, 26 Jun 2002 12:54:56 +0930
On Tue, Jun 25, 2002 at 04:21:32PM -0000, davem@gcc.gnu.org wrote:
> Synopsis: Run once loop should *always* be unrolled
This patch cures the problem. bootstrap i686-linux in progress.
* unroll.c (loop_iterations): Handle EQ loops.
Index: gcc/unroll.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unroll.c,v
retrieving revision 1.168
diff -u -p -r1.168 unroll.c
--- gcc/unroll.c 15 Jun 2002 01:10:49 -0000 1.168
+++ gcc/unroll.c 26 Jun 2002 03:19:38 -0000
@@ -3941,12 +3941,6 @@ loop_iterations (loop)
}
return 0;
}
- else if (comparison_code == EQ)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "Loop iterations: EQ comparison loop.\n");
- return 0;
- }
else if (GET_CODE (final_value) != CONST_INT)
{
if (loop_dump_stream)
@@ -3957,6 +3951,15 @@ loop_iterations (loop)
fprintf (loop_dump_stream, ".\n");
}
return 0;
+ }
+ else if (comparison_code == EQ)
+ {
+ if (loop_dump_stream)
+ fprintf (loop_dump_stream, "Loop iterations: EQ comparison loop.\n");
+ if (INTVAL (increment) == 0)
+ return 0;
+ loop_info->n_iterations = 1;
+ return loop_info->n_iterations;
}
/* Final_larger is 1 if final larger, 0 if they are equal, otherwise -1. */
--
Alan Modra
IBM OzLabs - Linux Technology Centre