how to avoid default inlining of static functions at O3 ?

Eljay Love-Jensen eljay@adobe.com
Fri Sep 26 20:41:00 GMT 2008


Hi John,

On my system, the flag differences between -O2 and -O3 are that -O3 also
enables:
-fgcse-after-reload
-finline-functions
-funswitch-loops

That may not be the same on your platform, however.

You can do this:

echo '' | g++ -O2 -fverbose-asm -S -x c++ - -o O2.txt
echo '' | g++ -O3 -fverbose-asm -S -x c++ - -o O3.txt

And then compare the flag differences on your platform.

Note, I do not know if there are other optimizations enabled by -O3 that do
not have associated flags.

Most optimizations do *NOT* have a knob to enable/disable.  But, perhaps,
most of those non-twiddle-able optimizations are already enabled at -O2.

HTH,
--Eljay



More information about the Gcc-help mailing list