[Bug c/97445] Some fonctions marked static inline in Linux kernel are not inlined

hubicka at ucw dot cz gcc-bugzilla@gcc.gnu.org
Tue Oct 20 06:44:50 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97445

--- Comment #27 from Jan Hubicka <hubicka at ucw dot cz> ---
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97445
> 
> --- Comment #23 from Christophe Leroy <christophe.leroy at csgroup dot eu> ---
> (In reply to Jan Hubicka from comment #19)
> > 
> > It is always possible to always_inline functions that are intended to be
> > always inlined.
> > Honza
> 
> Yes and I sent a patch for that to the Linux kernel, but what I would like to
> understand is why does GCC 10 completely fails to inline that while GCC 9 was
> doing things properly ?

It is because --param inline-insns-single was reduced for -O2 from 200
to 70.  GCC 10 has newly different set of parameters for -O2 and -O3 and
enables auto-inlining at -O2.

Problem with inlininig funtions declared inline is that C++ codebases
tends to abuse this keyword for things that are really too large (and
get_order would be such example if it did not have builtin_constant_p
check which inliner does not understand well). So having same limit at
-O2 and -O3 turned out to be problematic with respect to code size and
especially with respect to LTO, where a lot more inlining oppurtunities
appear.

I will implement the heuristics to push up inline limits of functions
having builtin_constant_p of parameter which should help a bit in this
case (but not very systematically: as dicussed in the PR log it is quite
hard problem to get builtin_constant_p right in the code size metrics
used by inliner before it knows exactly what is going to be constant and
what is not).

Honza


More information about the Gcc-bugs mailing list