From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gcc1-power7.osuosl.org (gcc1-power7.osuosl.org [140.211.15.137]) by sourceware.org (Postfix) with ESMTP id 868B1388A411 for ; Sun, 18 Apr 2021 15:03:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 868B1388A411 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=segher@gcc1-power7.osuosl.org Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id B051E12402ED; Sun, 18 Apr 2021 15:03:09 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: jakub@redhat.com, Segher Boessenkool Subject: [PATCH] combine: Don't create REG_UNUSED notes if the reg already died (PR99927) Date: Sun, 18 Apr 2021 15:03:07 +0000 Message-Id: X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham 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-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2021 15:03:20 -0000 If the register named in an existing REG_UNUSED note dies somewhere between where the note used to be and I3, we should just drop it. 2021-04-21 Segher Boessenkool PR rtl-optimization/99927 * combine.c (distribute_notes) [REG_UNUSED]: If the register already is dead, just drop it. --- Committed to trunk. This will need backports to all open branches. Segher gcc/combine.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/combine.c b/gcc/combine.c index 9063a07bd009..62bf4aeaabae 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -14366,6 +14366,11 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2, we keep notes from i2 or i1 if they will turn into REG_DEAD notes. */ + /* If this register is set or clobbered between FROM_INSN and I3, + we should not create a note for it. */ + if (reg_set_between_p (XEXP (note, 0), from_insn, i3)) + break; + /* If this register is set or clobbered in I3, put the note there unless there is one already. */ if (reg_set_p (XEXP (note, 0), PATTERN (i3))) -- 1.8.3.1