From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1671179379; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=tXlnzVukjMxmpBszmroRCEx3ekc0r3aR0LlZYP068MA=; b=DVl3yCJN4XCB7SVZWv1/KNVPuKUyFjHu+NTziECpG2sBVlUNy05ARlrSx2bixQG0EJwyJi NLgQgHXRC9SW8tPmgLZVnp56+tfEq2HRp0JVHu+MOnW4I7CTloXiK+uf9DOrHEOP2o2/5N qKH0thRu0fP2xx6fLuxzQJ9Lk6TSA7o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1671179379; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=tXlnzVukjMxmpBszmroRCEx3ekc0r3aR0LlZYP068MA=; b=d8lHDq0Wj7pNeDqpF/oG5xx52pyDomirnOWePNw1j+Pi2YPXxJ+NWaTCK+N2M63Dc4Ybcq M9GZq0D5bGeMIoBQ== 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) From: Richard Biener 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 Content-Type: text/plain; charset=US-ASCII 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 List-Id: Message-ID: <20221216082939.4JgVKqPwGle7XjBYkEoVJav98MqkMxuL7fpHhq5g5Nk@z> 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; } -- 2.35.3