On Tue, Oct 04, 2005 at 11:55:58AM +0200, Martijn van Oosterhout wrote: > It goes in to say that the limit is 10000 for gcc 2.95, but if you > examine the manual for gcc 3.3 it has the limit at 600. So it's > entirely possible that at the time the person wrote that code, it *was* > being inlined, but it sure isn't on some versions of some compilers. I > experimented and found that -finline-limit-1500 causes it to start > inlining.
From searching the web, it appears the inline limit was dropped from 10000 to 600 between gcc 3.0.0 and 3.0.1 in response to complaints about gcc memory usage. Any function that could be inlined needed to be kept in memory in semicompiled form and in C++ where lots of inlinable functions call eachother, the memory usage blew up completely. The difference between -O2 and -O3 is that the latter will consider any function for inlining, even if you didn't ask. For C programs that basically means any function declared static. Also, the number is "pseudo-instructions" and their meaning can change from version to version. Since we're pretty much relying on gcc to inline for performance, I still think we should add -Winline by default so we can tell when it's not doing what we want. Hope this helps, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them.
pgpkTvFoZ4PXA.pgp
Description: PGP signature