When compiling with -Os and -Winline, many warnings like this occur: file.cc:25: warning: inlining failed in call to 'function': --param inline-unit-growth limit reached
because the optimizer's inlining code gives up too early. The parameters most commonly exceeded are max-inline-insns-single, inline-unit-growth, and large-function-growth. This happens pretty much all the time in my code from all those deep STL interfaces, and I constantly have to specify some more appropriate (higher) values for the offending parameters. All C++ code I have ever seen is written with lots of inlines. Those inline functions, almost always reduce code size when inlined, and when the optimizer passes them by, it leaves behind function calls to simple accessors that could have been compiled as a single movl. Since -Os is supposed to optimize for size, it would be most logical to set those --param values to their maximum values (I use 1024, which works so far) to ensure all the inline functions are inlined. This works for -Os because -finline-functions is disabled and only those functions that are explicitly declared inline are inlined. With -finline-functions the large inlining parameters would probably generate nothing but bloat, and should remain at present values. -- Summary: -Os should maximize inlining --param values. Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: msharov at hotmail dot com GCC build triplet: athlon-gnu-linux GCC host triplet: athlon-gnu-linux GCC target triplet: athlon-gnu-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24947