From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id 1DE9B3850434; Tue, 20 Oct 2020 06:44:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1DE9B3850434 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=hubicka@kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 4E0BD28117C; Tue, 20 Oct 2020 08:44:44 +0200 (CEST) Date: Tue, 20 Oct 2020 08:44:44 +0200 From: Jan Hubicka To: "christophe.leroy at csgroup dot eu" Cc: gcc-bugs@gcc.gnu.org Subject: Re: [Bug c/97445] Some fonctions marked static inline in Linux kernel are not inlined Message-ID: <20201020064444.GA59402@kam.mff.cuni.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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:49 -0000 > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97445 > > --- Comment #23 from Christophe Leroy --- > (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