public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] middle-end/108086 - more operand scanner reduction in inlining
Date: Fri, 16 Dec 2022 08:29:39 +0000 (UTC)	[thread overview]
Message-ID: <20221216082939.4JgVKqPwGle7XjBYkEoVJav98MqkMxuL7fpHhq5g5Nk@z> (raw)

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 <gdebug *> (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

                 reply	other threads:[~2022-12-16  8:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221216082939.4JgVKqPwGle7XjBYkEoVJav98MqkMxuL7fpHhq5g5Nk@z \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).