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 8A4AD3856DF2 for ; Fri, 7 Oct 2022 13:03:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8A4AD3856DF2 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id F25B42804A4; Fri, 7 Oct 2022 15:03:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1665147835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DyE/zfkPzOTKKXjVUI8RzZmNi4ty6SiDWmMWwJFoeSE=; b=Jf3BmXAgDI6HQVl/oO0G8CQs3pstNRwfvekODabQK5PM0tAjv/ix1cGBssI1jT8vvYUSH9 G58VDEOuehCuCgvihjm7bSD04k20pdFmBD5+7KG/W/3A7832tEqvJkHVesVnAJVk1cll0/ qlo+rFHbsSpf5J0C8XsIUNwSQ68QokU= Date: Fri, 7 Oct 2022 15:03:54 +0200 From: Jan Hubicka To: Richard Biener Cc: Qing Zhao , Martin =?iso-8859-2?Q?Li=B9ka?= , "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH] IPA: support -flto + -flive-patching=inline-clone Message-ID: References: <137fde8c-7ade-ecc0-96f2-9ec828b4745e@suse.cz> <406C00D6-71C6-4D62-A772-448BB014A656@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > > WPA is Whole Program Analysis? > > Yes. > > > Okay, then It will promote all static function to extern functions. That’s reasonable. > > No, all extern functions to static functions. > > > Is it hard to preserve the original “static” visibility in the IR? > > Probably not hard, and the IPA pass adjusting visbility could as well > mark the functions > as not to be inlined with -flive-patching=inline-only-static. > > > > > > > OTOH inline-only-static could disable WPA inlining and do all inlining early ... > > > > Inline-only-static ONLY inlines static functions, how can it disable WPA inlining? Don’t quite understand here. > > it's a flag so it can be used to control other things GCC has two inliners 1) ealry inlininer which happens at compile time and is quite restricted only to obvious cases (always_inline, flatten and very small functions) 2) IPA inlining happening at link-time (WPA) which is using greedy algorithm and makes more complicated code size/speed tradeoffs Indeed betwen 1 and 2 previously global functions may become static by resolution info (they won't currently with kernel since we do incremental linking). We could easily keep track of originally static functions and promoted to static functions and make IPA inlining to honnor the patch. I however wonder how much LTO optimization would remain. If we disable all inter-module inlining and with live patching we also disable most of other optimization, I think basically only unreachable code removal will remain and possibly some propagation of "coldness" across the code. I can implement this incrementally. Martin, if live patching is happy about some symbols being promoted static, the patch is OK. Honza