From patchwork Fri Dec 3 04:26:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jojo R X-Patchwork-Id: 48454 Return-Path: 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 CAD103858010 for ; Fri, 3 Dec 2021 04:27:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CAD103858010 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1638505629; bh=WoSLv+qPGIfhzpMD1q3+Om6GOvtpDtUhFcL+SuXvrzw=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=jFnW1TsiXZK5Hf8aXPI3CYT3l7aZZAd5jrpjp7a0SszuTV/qJRDHm6r9z23Ix2G24 SEfGneyEKeGoKhOMh+VvEFdpUceLYh/vP/FcQf+0XxegVpDtJ2Hk+Gr2PAOjPahACd UC/Fr6MXiE/2/MYcoP86ARSKcG+iPnhISYS8+GGY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from out30-42.freemail.mail.aliyun.com (out30-42.freemail.mail.aliyun.com [115.124.30.42]) by sourceware.org (Postfix) with ESMTPS id F24B23858428 for ; Fri, 3 Dec 2021 04:26:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F24B23858428 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R101e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04423; MF=rjiejie@linux.alibaba.com; NM=1; PH=DS; RN=5; SR=0; TI=SMTPD_---0UzEREhZ_1638505597; Received: from localhost(mailfrom:rjiejie@linux.alibaba.com fp:SMTPD_---0UzEREhZ_1638505597) by smtp.aliyun-inc.com(127.0.0.1); Fri, 03 Dec 2021 12:26:37 +0800 To: rjiejie@linux.alibaba.com, gcc-patches@gcc.gnu.org, jeffreyalaw@gmail.com, richard.guenther@gmail.com, kito.cheng@gmail.com Subject: [PATCH v2] regrename: Skip renaming if instruction is noop move. Date: Fri, 3 Dec 2021 12:26:35 +0800 Message-Id: <20211203042635.5547-1-rjiejie@linux.alibaba.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <5cd26688-13a7-c1cc-f4ef-abaf1b806b23@gmail.com> References: <5cd26688-13a7-c1cc-f4ef-abaf1b806b23@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-18.8 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-Patchwork-Original-From: Jojo R via Gcc-patches From: Jojo R Reply-To: Jojo R Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Skip renaming if instruction is noop move, and it will been removed for performance. gcc/ * regrename.c (find_rename_reg): Return satisfied regno if instruction is noop move. --- gcc/regrename.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/regrename.c b/gcc/regrename.c index b8a9ca36f22..fe72fcc3624 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -394,6 +394,11 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class, this_head, *unavailable)) return this_head->tied_chain->regno; + /* If this insn is a noop move, then do not rename in this chain as doing so + would inhibit removal of the noop move. */ + if (noop_move_p (this_head->first->insn)) + return best_new_reg; + /* If PREFERRED_CLASS is not NO_REGS, we iterate in the first pass over registers that belong to PREFERRED_CLASS and try to find the best register within the class. If that failed, we iterate in