"GCC does an amazing job of poring over a complete 'program' and optimizing it when given the chance. Most programs (for perfectly valid reasons) are broken up into many source files for ease of maintenance, but this removes a large number of optimization opportunities."For the Linux kernel, this is especially true in file system code, I believe. At http://lwn.net/Articles/197097/ there is a reference to some work I did a while back on building the kernel with -fwhole-program --combine.
I should dig that out again.
"- Allowing more aggressive optimization has actually found real bugs in some of the code bases I've been working on, as the compiler has been able to see inside called functions and then report useful things like uninitialized variable usage that it could not do before."Shows up a few compiler bugs too...
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds