Re: Difference between two optimization settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Thomas,

> 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

-O0
Performs no optimizations.  It disables (bypasses) all the optimization
machinery.  Should make compile time faster, and easier to debug (-g), but
may hide certain bad (language non-compliant) bugs at runtime (which may
give a false impression that the code is correct), and won't generate a few
warnings from -Wall -Wextra which depend on optimization analysis.

-O1 -fno-yadayada...
Enables many optimizations, and the mentioned -fno-yadayada... flags will
disable that handful of specific optimizations.  (Most of the optimizations
have no independently twiddle-able flags.)

I like this trick to see which twiddle-able flags were enabled:

gcc -O1 -S -fverbose-asm -x c <(echo '') -o O1.s
cat O1.s

(Your command-line may differ, depending on your platform.)

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux