This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: your lno changes broke bootstrap on powerpc


Hello,

> Both powerpc-linux-gnu, and powerpc-darwin, no longer bootstrap after 
> your changes to the lno-branch.
> 
> They miscompile gengtype in stage1.

a bug in doloop.c uncovered by disabling loop header copying, and
caused by the fact that number of iterations in the old loop optimizer
means number of executions of loop body, not of the exit condition;
i.e. loops

i = 0;
goto e;
b:
  i++;
if i <= 4 goto b;

and

i = 0;
b:
  i++;
if i <= 4 goto b;

have the same number of iterations, but in the first case the exit
condition is executed one more time.

This is handled by doloop.c when the number of iterations must be
determined at runtime, but not when it is constant.

Zdenek

	* doloop.c (doloop_optimize): Update number of iterations for the
	loops entered at bottom.

Index: doloop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doloop.c,v
retrieving revision 1.19.2.9
diff -c -3 -p -r1.19.2.9 doloop.c
*** doloop.c	21 Jul 2003 13:50:41 -0000	1.19.2.9
--- doloop.c	4 Jan 2004 20:20:20 -0000
*************** doloop_optimize (const struct loop *loop
*** 785,790 ****
--- 785,794 ----
    n_iterations = loop_info->n_iterations;
    if (n_iterations)
      {
+       /* See the comment in doloop_modify_runtime.  */
+       if (loop->scan_start)
+ 	n_iterations += loop_info->unroll_number;
+ 
        /* This is the simple case where the initial and final loop
  	 values are constants.  */
        n_iterations_max = n_iterations;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]