This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Difference between two optimization settings
- From: Thomas Heinz <thomasheinz at gmx dot net>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 28 Jun 2008 14:43:51 +0200
- Subject: Difference between two optimization settings
Hi
What is the difference between
-O0
and
-O1 -fno-defer-pop -fno-merge-constants -fno-thread-jumps -fno-loop-optimize
-fno-if-conversion -fno-if-conversion2 -fno-delayed-branch
-fno-guess-branch-probability -fno-cprop-registers -fno-omit-frame-pointer
My gcc 3.4.6 man page says:
-O
-O1 Optimize. Optimizing compilation takes somewhat more time, and a lot
more memory for a large function.
With -O, the compiler tries to reduce code size and
execution time, without performing any optimizations that
take a great deal of compilation time.
-O turns on the following optimization flags: -fdefer-pop
-fmerge-constants -fthread-jumps -floop-optimize
-fif-conversion -fif-conversion2 -fdelayed-branch
-fguess-branch-probability -fcprop-registers
-O also turns on -fomit-frame-pointer on machines where doing
so does not interfere with debugging.
One thing I noticed is that the second optimization setting performs
constant propagation and constant folding.
If the answer to my question depends upon the gcc version (assuming gcc >=
3.4), then I'd be most interested in 3.4 or more specific 3.4.5.
The source language is C.
Thanks a lot for your support.
Cheers,
Thomas