From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTPS id BAAD43858D3C for ; Tue, 25 Oct 2022 02:49:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BAAD43858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A0F771162A1; Mon, 24 Oct 2022 22:49:09 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id lLS6u7VFseDA; Mon, 24 Oct 2022 22:49:09 -0400 (EDT) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id 650C0116277; Mon, 24 Oct 2022 22:49:08 -0400 (EDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 29P2mxKr083632 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 23:49:00 -0300 From: Alexandre Oliva To: Qing Zhao Cc: "gcc-patches\@gcc.gnu.org" Subject: Re: [PATCH zero-call-used-regs] Add leafy mode for zero-call-used-regs Organization: Free thinker, does not speak for AdaCore References: <66ECAC37-E763-4469-B31A-7A2B031026F4@oracle.com> Errors-To: aoliva@lxoliva.fsfla.org Date: Mon, 24 Oct 2022 23:48:59 -0300 In-Reply-To: <66ECAC37-E763-4469-B31A-7A2B031026F4@oracle.com> (Qing Zhao's message of "Fri, 21 Oct 2022 14:26:13 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,KAM_SHORT,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: Hello, Qing, It was a pleasure to meet you at the Cauldron. On Oct 21, 2022, Qing Zhao wrote: > Hi, Alexandre, > Could you please explain a little bit on the motivation of this patch first? It was a suggestion I got after the Cauldron presentation. It made sense to me, and was easy enough to implement. 'all' for leaf functions is likely wasteful. If no other functions are called, one can determine exactly which registers might carry information out and thus need zeroing, and 'used' is thus likely enough, depending on the purpose of register scrubbing. (In some scenarios, it might make sense to want scrubbing of all registers, even unused ones that carry incoming values) Though some functions are coded as leaf functions, others may become leaf functions because of inlining or other optimizations. It's hard for users to predict, so it makes sense to have a mode that tells the compiler to figure it out. There's room for a follow-up improvement, to save on a little more potentially-wasteful anti-leaking scrubbing even in non-leaf functions: for this purpose, they need not scrub registers that they don't use themselves, if all potential callees are known to have scrubbed them. I have not (yet?) implemented this variant; I haven't even found a name I'm happy with for it. (seal? plug? cork? another leak antonym?) I'm not entirely happy with leafy either, FWIW. Bikeshedding anyone? :-) https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604083.html -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer Disinformation flourishes because many people care deeply about injustice but very few check the facts. Ask me about