This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Difference between -O3 and -O2 with the -f options -O3 adds
On Wednesday 29 July 2009 18:57:30 Michael Meissner wrote:
> On Wed, Jul 29, 2009 at 05:43:25PM +0200, Matthias Kretz wrote:
> This is likely due to two places in the compiler that look at optimization
> level as a value, instead of just as as the component switches.
There seem to be more places than what you pointed out...
> The first place is in tree-ssa-pre.c, which sets the boolean
> do_partial_partial if -O3 and there is no extra switch to control this::
I changed
> do_partial_partial = optimize > 2;
to
do_partial_partial = optimize > 3;
compiled with -O3 and the problem remains.
> In opts.c, two parameter values are adjusted if -O3 in addition to the -f
> options:
>
>
> /* Allow even more virtual operators. Max-aliased-vops was set above
> for -O2, so don't reset it unless we are at -O3. */
> if (opt3)
> set_param_value ("max-aliased-vops", 1000);
>
> set_param_value ("avg-aliased-vops", (opt3) ? 3 :
> initial_avg_aliased_vops);
I used -O2 -f... --param max-aliased-vops=1000 --param avg-aliased-vops=3 and
it didn't fail.
Now looking at the other places grep shows:
tree-ssa-loop.c:509: changed >= 3 to > 3: still fails.
tree-ssa-loop.c:550: changed >= 3 to > 3: still fails.
tree-ssa-loop-niter.c:1831: changed >= 3 to > 3: still fails.
So it's a combination?
commented out the set_param_value calls in opts.c, and changed all optimize >=
3 to > 3 (i.e. not the do_partial_partial test): test passes.
only changed all optimize >= 3 to > 3: test passes.
only changed tree-ssa-loop.c lines 509 and 550: test passes.
So the result is that if tree-ssa-loop.c calls tree_unroll_loops_completely
with may_increase_size = true then my test fails.
Does that ring a bell somewhere - any more tips for debugging? Or should I try
to reduce a testcase next?
Regards,
Matthias