Optimizations and the -pedantic option

Ian Lance Taylor iant@google.com
Fri Feb 29 15:34:00 GMT 2008


"Dario Saccavino" <kathoum@gmail.com> writes:

> It seems that a transformation that is supposed to help optimization
> (seeing j as a constant value instead of a variable) has a negative
> effect.

Yes.  It's because of this comment in tree-tailcall.c:

      /* There should be no previous addition.  TODO -- it should be fairly
	 straightforward to lift this restriction -- just allow storing
	 more complicated expressions in *A, and gimplify it in
	 adjust_accumulator_values.  */


> I've just finished compiling gcc 4.2.3, and I'm very pleased to
> announce that all of the snippets posted to this thread are properly
> optimized (with -O2). Hail to the gcc team!

Interestingly, this was fixed not by fixing the above case, but by
disabling a different, incorrect, optimization.  The patch which
re-enables the tailcall optimization is the patch for
http://gcc.gnu.org/PR30364 .

Ian



More information about the Gcc-help mailing list