Difference between two optimization settings

Thomas Heinz thomasheinz@gmx.net
Sat Jun 28 12:45:00 GMT 2008


What is the difference between



-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:

-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.



More information about the Gcc-help mailing list