Message ID | 06f201d89e76$4ddb3210$e9919630$@nextmovesoftware.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5560B3857427 for <patchwork@sourceware.org>; Sat, 23 Jul 2022 09:26:54 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id 7A7803858C50 for <gcc-patches@gcc.gnu.org>; Sat, 23 Jul 2022 09:26:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7A7803858C50 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nextmovesoftware.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=i9/BX/UZ78CrjuqKB3H+lLxytmCxLdlU4G2tLDi9JxQ=; b=GcOQWqQVTy0hJ+JeoXVm4Ev0dI 7LpCZa1hfzOnhyd/P+9Fw/DxC7jhu3Ox71wI7TYfnV/47ELwPTb9s9zcNwbsx+RMKbfbHjB88MzVn OQF5qXBUI7v68LoBofpXZVIvEMRSUWjswaA8UYers4qb4lm1vZb1F82hjZVs3+j6TZXUZYVHyMsmq DpmnTP0GUb1bDE62Gjn8ZcphwkqSa5TZz4BSRu4iZVyTx6DNk0PPITSh/SrCSRPdxdFr+V1UxG/lY 8YlTcm4QjJ2381ZSPlyy8l0XYZ+IqgMqaTJmFt0QdnDItfIb3Q671rqRhP3YlLqFgiI7ACnWZieu0 uSSdTVfw==; Received: from host109-154-33-170.range109-154.btcentralplus.com ([109.154.33.170]:55476 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from <roger@nextmovesoftware.com>) id 1oFBPA-0002eq-QV for gcc-patches@gcc.gnu.org; Sat, 23 Jul 2022 05:26:37 -0400 From: "Roger Sayle" <roger@nextmovesoftware.com> To: "'GCC Patches'" <gcc-patches@gcc.gnu.org> Subject: [Documentation] Correct RTL documentation: (use (mem ...)) is allowed. Date: Sat, 23 Jul 2022 10:26:34 +0100 Message-ID: <06f201d89e76$4ddb3210$e9919630$@nextmovesoftware.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_06F3_01D89E7E.AFA20B10" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdiedaHS00uNQURJRnGXcZAXkmSqzg== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
[Documentation] Correct RTL documentation: (use (mem ...)) is allowed.
|
|
Commit Message
Roger Sayle
July 23, 2022, 9:26 a.m. UTC
This patch is a one line correction/clarification to GCC's current RTL documentation that explains a USE of a MEM is permissible. PR rtl-optimization/99930 is an interesting example on x86_64 where the backend generates better code when a USE is a (const) MEM than when it is a REG. In fact the backend relies on CSE to propagate the MEM (a constant pool reference) into the USE, to enable combine to merge/simplify instructions. This change has been tested with a make bootstrap, but as it might provoke a discussion, I've decided to not consider it "obvious". Ok for mainline (to document the actual current behavior)? 2022-07-23 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog * doc/rtl.texi (use): Document that the operand may be a MEM. Roger --
Comments
On 7/23/22 03:26, Roger Sayle wrote: > This patch is a one line correction/clarification to GCC's current > RTL documentation that explains a USE of a MEM is permissible. > > PR rtl-optimization/99930 is an interesting example on x86_64 where > the backend generates better code when a USE is a (const) MEM than > when it is a REG. In fact the backend relies on CSE to propagate the > MEM (a constant pool reference) into the USE, to enable combine to > merge/simplify instructions. > > This change has been tested with a make bootstrap, but as it might > provoke a discussion, I've decided to not consider it "obvious". > Ok for mainline (to document the actual current behavior)? > > > 2022-07-23 Roger Sayle <roger@nextmovesoftware.com> > > gcc/ChangeLog > * doc/rtl.texi (use): Document that the operand may be a MEM. Given this is documenting existing behavior and it's not hard to envision the MEM being useful in this context. OK. jeff
> > This patch is a one line correction/clarification to GCC's current > > RTL documentation that explains a USE of a MEM is permissible. > > > > PR rtl-optimization/99930 is an interesting example on x86_64 where > > the backend generates better code when a USE is a (const) MEM than > > when it is a REG. In fact the backend relies on CSE to propagate the > > MEM (a constant pool reference) into the USE, to enable combine to > > merge/simplify instructions. > > > > This change has been tested with a make bootstrap, but as it might > > provoke a discussion, I've decided to not consider it "obvious". > > Ok for mainline (to document the actual current behavior)? > > > > > > 2022-07-23 Roger Sayle <roger@nextmovesoftware.com> > > > > gcc/ChangeLog > > * doc/rtl.texi (use): Document that the operand may be a MEM. > > Given this is documenting existing behavior and it's not hard to > envision the MEM being useful in this context. OK. I would like to point out at this occasion that there are some issues with (use (mem)) when commutative operands are used. PR95218 has a testcase where the postreload pass simply removed the instruction (see comment #6). It was later found out in comment #17 that commutative operands in (use (...)) statements somehow confuse postreload pass. I have to remove commutative operands from (use (...)) to solve the issue, so either this unfortunate fact should be mentioned in the documentation or the limitation (bug?) should be fixed in the postreload pass. Uros.
diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi index 43c9ee8..995c8be 100644 --- a/gcc/doc/rtl.texi +++ b/gcc/doc/rtl.texi @@ -3283,7 +3283,8 @@ Represents the use of the value of @var{x}. It indicates that the value in @var{x} at this point in the program is needed, even though it may not be apparent why this is so. Therefore, the compiler will not attempt to delete previous instructions whose only effect is to -store a value in @var{x}. @var{x} must be a @code{reg} expression. +store a value in @var{x}. @var{x} must be a @code{reg} or a @code{mem} +expression. In some situations, it may be tempting to add a @code{use} of a register in a @code{parallel} to describe a situation where the value