From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id 1F36A3858CDA for ; Fri, 7 Oct 2022 06:34:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1F36A3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x535.google.com with SMTP id m3so5655476eda.12 for ; Thu, 06 Oct 2022 23:34:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=AXSzaP07z8sEypLpP+IRKKWnIcMu22MvKKoTKGAXKFs=; b=X1SUN5NoPMvK0srg2e1gb5QnvAqfnVevdBKUjy2l8qJDT7j1eQmWiKwMYxV8nmw9zu XPochG8YhVxsLZPEUXaVad40Ub50/7Mn91dvhbYuyCzvTR2zEKpBXLxlv4yukY/7wOX8 lN9qihwBub9XU0IdZCFg52JhLzgyE1l3y19ltdYVaLhjOMmZNBx3dAXWL0WPDkmWjmxU ur1ILnGMAF4FL9GaQ1HIZKq6Iw5OtSC35N+ZCQZaafybszunOfzCkL21J8BpfrsavxfV TkQmp3Z6tn4nxjCE6pFIp3dldh6Oft/HDTDEAIEnNRwGNa3oVgjCVrgUnUeVct+6bkyC z3VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=AXSzaP07z8sEypLpP+IRKKWnIcMu22MvKKoTKGAXKFs=; b=LUPPF0mIn0e/BlwePsedUpsYsSYrT496IcfTrdseXaKFSjnNHcUgZBd5mp3X1IF3B4 tpaUn8kUwM+mEWmW5IzJmfrupo9SzAR0nFGVpg/ML+BF6XxCpNe8RSkZ3SJvUdbBPsU7 SNWnqpbut32v4nxGmGNdnmQT7n0zeXTbk/+tmJ3/JzVFDFyXG0xI9fK6/q3Mn/ur5RzR 73hrB4qyoqIonB0iYj8HNi6zsy+gnVDkcJm95QaF2ZIXv7/SDtDFyJiWCVDzfblMDG3u GcPLtLfFiDftpw1OP6MNAB8DVYZy/syIp0q3ZFR1+vjXf0WIQVgLHTbTPOtZKToCnnOd PePg== X-Gm-Message-State: ACrzQf1CUpE5CC3NNfxovJuQuuORHG53G2CC+jkt+WkqB6ChKP8228y7 bpe/nLc9sJp4Wx6oBJALMmVW6Zcm0S6R5BCve0hLjGAsFOY= X-Google-Smtp-Source: AMsMyM4FIqkZbUPp/9tVOWePcNU4xWX2jAklLTaT3088hhMMzTpcg8izzGzCsMpH5WX+KGjDJwN69+dFpGwQUJW340Q= X-Received: by 2002:a05:6402:11cd:b0:452:199e:7cf6 with SMTP id j13-20020a05640211cd00b00452199e7cf6mr3178013edw.366.1665124486977; Thu, 06 Oct 2022 23:34:46 -0700 (PDT) MIME-Version: 1.0 References: <137fde8c-7ade-ecc0-96f2-9ec828b4745e@suse.cz> <406C00D6-71C6-4D62-A772-448BB014A656@oracle.com> In-Reply-To: <406C00D6-71C6-4D62-A772-448BB014A656@oracle.com> From: Richard Biener Date: Fri, 7 Oct 2022 08:34:34 +0200 Message-ID: Subject: Re: [PATCH] IPA: support -flto + -flive-patching=inline-clone To: Qing Zhao Cc: =?UTF-8?Q?Martin_Li=C5=A1ka?= , "gcc-patches@gcc.gnu.org" , Jan Hubicka Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Oct 6, 2022 at 3:18 PM Qing Zhao wrote: > > > > > On Oct 6, 2022, at 4:29 AM, Richard Biener = wrote: > > > > On Wed, Oct 5, 2022 at 8:18 PM Qing Zhao via Gcc-patches > > wrote: > >> > >> > >> > >>> On Oct 5, 2022, at 1:36 PM, Martin Li=C5=A1ka wrote: > >>> > >>> On 10/5/22 16:50, Qing Zhao wrote: > >>>> I have two questions on this: > >>> > >>> Hello. > >>> > >>>> > >>>> 1. What=E2=80=99s the motivation to enable -flive-patching with -fl= to? Is there any application that will try -flive-patching with -flto now? > >>> > >>> We're planning supporting GCC LTO Linux kernel support, so that's one= motivation. And the second one is a possible > >>> use in user-space livepatching. Note majority of modern distros defau= lt to -flto (openSUSE, Fedora, Debian, Ubuntu, ...). > >> > >> Okay, I see. That=E2=80=99s reasonable. > >>> > >>>> > >>>> 2. Why only enable -flive-patching=3Dinline-clone with -flto? > >>> > >>> Because the inline-only-static level (which you added/requested) woul= d have to properly > >>> block inter-procedural inlining that happens in LTO (can_inline_edge_= by_limits_p) and > >>> I'm not sure it would be properly blocked. So, feel free to extend my= patch if you want? > >> > >> -flive-patching=3Dinline-only-static > >> > >> Only enable static functions inlining, all the inlining of external v= isible functions are blocked, So, LTO should be compatible with this natura= lly without any issue, I think. > >> > >> i.e, when "-flive-patching=3Dinline-only-static -flto" present togeth= er, all the inter-procedural inlining should be automatically blocked by -f= live-patching=3Dinline-only-static already. > >> > >> Do I miss anything here? > > > > WPA will promote externally visible functions static when all accesses > > are from LTO IR, I don't think we preserve > > the "original" visibility for IPA inlining heuristics. > > WPA is Whole Program Analysis? Yes. > Okay, then It will promote all static function to extern functions. That= =E2=80=99s reasonable. No, all extern functions to static functions. > Is it hard to preserve the original =E2=80=9Cstatic=E2=80=9D visibility i= n 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=3Dinline-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=E2=80=99t quite understand here. it's a flag so it can be used to control other things > thanks. > > Qing > > > > Richard, > > > >> > >> thanks. > >> > >> Qing > >> > >>> > >>> Martin > >>> > >>>> > >>>> thanks. >