From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id D27BE3858D37 for ; Tue, 24 Oct 2023 10:50:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D27BE3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D27BE3858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698144640; cv=none; b=nMCShQsMYOfW4HySPSGwl6vGb2TFcqjISVslkM58fFAExmHxAdcFkjeL8Q4vL7jDgh8JfRw7hzcVWa2JLc7Zvb0vzbgjnjgUT9XgxEK9D6PcCbG7KqnNZLup5rhkNc/J+WW7XqqyGBz2pLb6ZSFS15oaIUMnsocKwcqDhIVjL40= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698144640; c=relaxed/simple; bh=IV99aYtsb9iovGz+496UfOvEcRK3IkiOsaUfvQA/c8c=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=sCtzJvIxQoqEf6j7nYDobKrIJEfVDb7NqXmGiyQ6YLdyL4I55jeum84dVHxOwYw0PI+kNHXeYb8h17llA+0l7B8iYJyTvrQVKyDOFZS7Gd5zIIL9Pjs2NZS/Pg3epe7lt3Y6Vc/CIPcOWu6tJjF3BPZrL+F+o7hKSoAsIuCFGM4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9A3B01424; Tue, 24 Oct 2023 03:51:16 -0700 (PDT) Received: from e121540-lin.manchester.arm.com (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0CA353F64C; Tue, 24 Oct 2023 03:50:34 -0700 (PDT) From: Richard Sandiford To: jlaw@ventanamicro.com, gcc-patches@gcc.gnu.org Cc: Richard Sandiford Subject: [PATCH 2/6] rtl-ssa: Create REG_UNUSED notes after all pending changes Date: Tue, 24 Oct 2023 11:50:02 +0100 Message-Id: <20231024105006.3337671-3-richard.sandiford@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231024105006.3337671-1-richard.sandiford@arm.com> References: <20231024105006.3337671-1-richard.sandiford@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-24.0 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,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: Unlike REG_DEAD notes, REG_UNUSED notes need to be kept free of false positives by all passes. function_info::change_insns does this by removing all REG_UNUSED notes, and then using add_reg_unused_notes to add notes back (or create new ones) where appropriate. The problem was that it called add_reg_unused_notes on the fly while updating each instruction, which meant that the information for later instructions in the change set wasn't up to date. This patch does it in a separate loop instead. gcc/ * rtl-ssa/changes.cc (function_info::apply_changes_to_insn): Remove call to add_reg_unused_notes and instead... (function_info::change_insns): ...use a separate loop here. --- gcc/rtl-ssa/changes.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/rtl-ssa/changes.cc b/gcc/rtl-ssa/changes.cc index de6222ae736..c73c23c86fb 100644 --- a/gcc/rtl-ssa/changes.cc +++ b/gcc/rtl-ssa/changes.cc @@ -586,8 +586,6 @@ function_info::apply_changes_to_insn (insn_change &change) insn->set_accesses (builder.finish ().begin (), num_defs, num_uses); } - - add_reg_unused_notes (insn); } // Add a temporary placeholder instruction after AFTER. @@ -733,9 +731,14 @@ function_info::change_insns (array_slice changes) } } - // Finally apply the changes to the underlying insn_infos. + // Apply the changes to the underlying insn_infos. for (insn_change *change : changes) apply_changes_to_insn (*change); + + // Now that the insns and accesses are up to date, add any REG_UNUSED notes. + for (insn_change *change : changes) + if (!change->is_deletion ()) + add_reg_unused_notes (change->insn ()); } // See the comment above the declaration. -- 2.25.1