From patchwork Fri Dec 16 08:29:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 33901 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp841555wrn; Fri, 16 Dec 2022 00:30:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf7oW07s0zmNXpzR3UFMU5XAQL5AWjej80MrdiGs+z2Hw+T+gEH3r6/vUje9FAN9hGFs1173 X-Received: by 2002:a17:906:2881:b0:7ad:d835:e822 with SMTP id o1-20020a170906288100b007add835e822mr26015699ejd.42.1671179447751; Fri, 16 Dec 2022 00:30:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671179447; cv=none; d=google.com; s=arc-20160816; b=KEAl7kR1YYOmu3KN9JIrSkxZadMbFRSKk4kZo3Z/8XPskXBgE38eAdbs+5DhNGbJEp 000nFPJcX+iVe2bQhHH38CCvoupsQaiy8qQDJoT2s3nVOYE201aRFMihndW8R4vY27FB NM7HNUswFkNfhrDjQ1Jht447HYUldhq1vW2sGZOH+tO8Qocn1yTcpH8CUDxgI6kG28Uj DNU1Jv9SlmTsgfn1vtNflXLHVGeAo6tlrc+uwWPSJ92W+QiDJZOsJRLICZdQxe5qeGlT fX1FWVPdHLRLtWg3FeFV1BqDCbQqMeIu1YZvEDbSs+3OPbMSgiR50ofd3PrOca1CfGb/ PyDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:sender:errors-to:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:user-agent:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=tXlnzVukjMxmpBszmroRCEx3ekc0r3aR0LlZYP068MA=; b=to/KNLXkzENQT1+8Yp765s5/OwPDSEHiEDZ687hVBXsrkK5HfDQvHn1V72qlFqqV/u xGJYHqnXMdFhRW9C2xeac6jRplOX87UgV0cbNNKkDSBoW4TVfa2Ty6M0CSCRosvM0lLH FM6V/5Sxy66/m/P4NANl/GFhkyaGKEOamXJGV1+OYugk8or63Qp4jSXo2adDMrcOaI1V ICD3vnPA+JIRaWs5rFaEKRxXnYQP+ZFynZMuxSZDWf67qQFWnQ3CzSjQqI10XxoC+8Uy yQ5oe8ZQRraLkNPkS/uqLQ7zljoe+dw/ceurAdhFIDsaiWldsInp4oPsWxewEr63X9/g Qjyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=prLEM+19; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ss9-20020a170907c00900b007c1286ad884si1639083ejc.677.2022.12.16.00.30.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 00:30:47 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=prLEM+19; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ACE883817F8B for ; Fri, 16 Dec 2022 08:30:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACE883817F8B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671179434; bh=tXlnzVukjMxmpBszmroRCEx3ekc0r3aR0LlZYP068MA=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=prLEM+19tmVNXO3UmydcQ689MBDWK1f/ppSu60a4O509MKDCAwDOjx9lS2x+EjKwd eOi+zrMxVJSKLhT657AsqM6+RzHkJKXLC3ZHgy9+q4M++rIrTHik2crw06E0kYUmbZ 6aAZJy0kc0nJwo9UZl9k48cqFPFo6V8FNKD579V4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id D55A23896C3A for ; Fri, 16 Dec 2022 08:29:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D55A23896C3A Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id B2CDE5CAE2 for ; Fri, 16 Dec 2022 08:29:39 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id AEB4A2C146 for ; Fri, 16 Dec 2022 08:29:39 +0000 (UTC) Date: Fri, 16 Dec 2022 08:29:39 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] middle-end/108086 - more operand scanner reduction in inlining User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" Message-Id: <20221216083034.ACE883817F8B@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752358660435077756?= X-GMAIL-MSGID: =?utf-8?q?1752358660435077756?= There's another round of redundant operand scanning in remap_gimple_stmt. The following removes this and also improves one special-case to call a cheaper inline function. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR middle-end/108086 * tree-inline.cc (remap_gimple_stmt): Add stmts to the sequence without updating them. Simplify x == x detection. --- gcc/tree-inline.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc index 79897f41e86..ad8275185ac 100644 --- a/gcc/tree-inline.cc +++ b/gcc/tree-inline.cc @@ -1535,7 +1535,7 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id) if (id->reset_location) gimple_set_location (bind, input_location); id->debug_stmts.safe_push (bind); - gimple_seq_add_stmt (&stmts, bind); + gimple_seq_add_stmt_without_update (&stmts, bind); return stmts; } @@ -1765,7 +1765,7 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id) } else { - if (gimple_assign_copy_p (stmt) + if (gimple_assign_single_p (stmt) && gimple_assign_lhs (stmt) == gimple_assign_rhs1 (stmt) && auto_var_in_fn_p (gimple_assign_lhs (stmt), id->src_fn)) { @@ -1833,7 +1833,7 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id) if (id->reset_location) gimple_set_location (copy, input_location); id->debug_stmts.safe_push (copy); - gimple_seq_add_stmt (&stmts, copy); + gimple_seq_add_stmt_without_update (&stmts, copy); return stmts; } if (gimple_debug_source_bind_p (stmt)) @@ -1845,7 +1845,7 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id) if (id->reset_location) gimple_set_location (copy, input_location); id->debug_stmts.safe_push (copy); - gimple_seq_add_stmt (&stmts, copy); + gimple_seq_add_stmt_without_update (&stmts, copy); return stmts; } if (gimple_debug_nonbind_marker_p (stmt)) @@ -1859,7 +1859,7 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id) gdebug *copy = as_a (gimple_copy (stmt)); id->debug_stmts.safe_push (copy); - gimple_seq_add_stmt (&stmts, copy); + gimple_seq_add_stmt_without_update (&stmts, copy); return stmts; } @@ -1967,7 +1967,7 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id) !gsi_end_p (egsi); gsi_next (&egsi)) walk_gimple_op (gsi_stmt (egsi), remap_gimple_op_r, &wi); - gimple_seq_add_seq (&stmts, extra_stmts); + gimple_seq_add_seq_without_update (&stmts, extra_stmts); } } @@ -2006,14 +2006,14 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id) gimple_cond_code (cond), gimple_cond_lhs (cond), gimple_cond_rhs (cond)); - gimple_seq_add_stmt (&stmts, cmp); + gimple_seq_add_stmt_without_update (&stmts, cmp); gimple_cond_set_code (cond, NE_EXPR); gimple_cond_set_lhs (cond, gimple_assign_lhs (cmp)); gimple_cond_set_rhs (cond, boolean_false_node); } } - gimple_seq_add_stmt (&stmts, copy); + gimple_seq_add_stmt_without_update (&stmts, copy); return stmts; }