From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 68F423850434; Tue, 20 Oct 2020 06:44:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68F423850434 From: "hubicka at ucw dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/97445] Some fonctions marked static inline in Linux kernel are not inlined Date: Tue, 20 Oct 2020 06:44:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at ucw dot cz X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Oct 2020 06:44:50 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97445 --- Comment #27 from Jan Hubicka --- > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97445 >=20 > --- Comment #23 from Christophe Leroy --- > (In reply to Jan Hubicka from comment #19) > >=20 > > It is always possible to always_inline functions that are intended to be > > always inlined. > > Honza >=20 > Yes and I sent a patch for that to the Linux kernel, but what I would lik= e 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=