Differences between -O2 and -O3
bernd Kopf
bayerntoni@hotmail.de
Tue Aug 17 15:42:00 GMT 2010
> The differences between -O2 and -O3 is not only the optimization flags
> you saw in man gcc or output of -Q. At least in gcc/opts.c, you can see
> -O3 also set some parameters which affect the accuracy of alias
> analysis. So maybe you need to search the source code to find the exact
> differences between these two optimization levels.
>
> Lei
Well in gcc/opts.c I see:
/* Track fields in field-sensitive alias analysis. */
set_param_value ("max-fields-for-field-sensitive",
(opt2) ? 100 : initial_max_fields_for_field_sensitive);
/* For -O1 only do loop invariant motion for very small loops. */
set_param_value ("loop-invariant-max-bbs-in-loop",
(opt2) ? initial_loop_invariant_max_bbs_in_loop : 1000);
But unless I'm wrong it sets the same value for -O2 and -O3.
I was hoping there was a switch like -v or -Q to get a full list of enabled switches and params.
It looks the level of optimizations is not only done in gcc/opts.c but a bit everywhere in the source. I found some bits in tree-ssa-loops.c, tree-ssa-loops-niter.c,...
Unfortunatly (for me) these extra optimizations enabled by -O3 don't look controllable by the command line. But at least I have the answer to my question so it's useless I spend more time on this.
Thanks for the help.
More information about the Gcc-help
mailing list