Why are the optimization settings not what the docs say they should be

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

 



Hello,

I'd like to understand why the optimization settings for -O2 and -Os aren't what the docs say they should be.  I ran these two commands:

$ gcc -Q -O2 --help=optimizers > O2settings
$ gcc -Q -Os --help=optimizers > Ossettings

and then diff'd the files.  Since I'm using gcc 4.4.7 on CentOS 6.5, I'm referencing these docs: https://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/Optimize-Options.html#Optimize-Options.  These docs say that -Os and -O2 are identical with the following exceptions:

- falign-functions
- falign-jumps
- falign-loops
- falign-labels
- freorder-blocks
- freorder-blocks-and-partition
- fprefetch-loop-arrays
- ftree-vect-loop-version

The docs tell me that these are disabled in -Os from -O2.  However, if I've used the gcc command correctly, this tells a much different story.  In each case, the value for -Os and -O2 are identical.  All are enabled except for falign-loops, freorder-blocks-and-partition and fprefetch-loop-arrays.  Most importantly, however, they are all the same for either optimization level.

In fact, the only difference between the two is finline-functions: which is *off* in -O2 and *on* in -Os.  That seems incorrect.  Since -Os is concerned with size, wouldn't that option want to be disabled, not enabled, for size conscious optimization?

If this is something that the GCC team isn't responsible for, because, perhaps, GCC was built by the CentOS people, that's fine.  I'll take up the question with them.  I'd like to know if I've just misunderstood the command issued to look at optimization settings (I've made those mistakes before).

Thanks,
Andy 







[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