In the last episode (Jan 16), David Hedbor @ Pike developers forum said:
Is there a reason while '-O2' is the "max" -Ox flag and not -O3? I.e have there been any specific problems or are there other reasons?
All -O3 does is add -finline_functions and -frename_registers. Inline-functions tends to make the final code bigger than -O2, which could be an issue on machines with small caches, and the docs say that rename_registers can confuse gdb since a variable may exist in different registers over its lifetime. I usually use -O2 and -march or -mcpu (depending on the platform)
I'm specifically asking because the Intel compiler has a -O3 which might be worth enabling (even though to be honest it doesn't say that it will help - it might make things slower). From the docs:
-O3 (IA-32 only): Enables -O2 option with more aggressive optimization. Optimizes for maximum speed, but does not guarantee higher performance unless loop and memory access transformation take place. In conjunction with -axK and -xK options (IA-32 only), this option causes the compiler to perform more aggressive data dependency analysis than for -O2. This may result in longer compilation times.
-O3 (Both IA-32 and 64): Enables -O2 option with more aggressive optimization, for example, prefetching, scalar replacement, and loop transformations. Optimizes for maximum speed, but does not guarantee higher performance unless loop and memory access transformation take place.
Now mind you I don't know if that's a (noticeable) benefit or not. :-)
/ David Hedbor
Previous text:
2003-01-16 03:48: Subject: Re: -O3
In the last episode (Jan 16), David Hedbor @ Pike developers forum said:
Is there a reason while '-O2' is the "max" -Ox flag and not -O3? I.e have there been any specific problems or are there other reasons?
All -O3 does is add -finline_functions and -frename_registers. Inline-functions tends to make the final code bigger than -O2, which could be an issue on machines with small caches, and the docs say that rename_registers can confuse gdb since a variable may exist in different registers over its lifetime. I usually use -O2 and -march or -mcpu (depending on the platform)
-- Dan Nelson dnelson@allantgroup.com
/ Brevbäraren