public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Filip Kastl <pheeck@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/pheeck/heads/sccp)] sccp handling was_noreturn and can_make_abnormal_goto
Date: Thu,  2 Mar 2023 12:13:20 +0000 (GMT)	[thread overview]
Message-ID: <20230302121320.B7D6F3858D33@sourceware.org> (raw)

https://gcc.gnu.org/g:72b7332883ae3380f0e18280a89fa55ef00d0b2d

commit 72b7332883ae3380f0e18280a89fa55ef00d0b2d
Author: Filip Kastl <filip.kastl@gmail.com>
Date:   Tue Feb 28 13:00:14 2023 +0100

    sccp handling was_noreturn and can_make_abnormal_goto

Diff:
---
 gcc/sccp.cc               | 11 +++++++++--
 gcc/tree-ssa-propagate.cc |  3 ++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/gcc/sccp.cc b/gcc/sccp.cc
index 6c8791d8724..57c821a4f9c 100644
--- a/gcc/sccp.cc
+++ b/gcc/sccp.cc
@@ -455,6 +455,14 @@ replace_use_by (tree get_replaced, tree replace_by, bitmap need_eh_cleanup,
   gimple *use_stmt;
   FOR_EACH_IMM_USE_STMT (use_stmt, iter, get_replaced)
     {
+      bool was_noreturn = false;
+      bool can_make_abnormal_goto = false;
+      if (is_gimple_call (use_stmt))
+	{
+	  was_noreturn = gimple_call_noreturn_p (use_stmt);
+	  can_make_abnormal_goto = stmt_can_make_abnormal_goto (use_stmt);
+	}
+
       FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
 	SET_USE (use_p, unshare_expr (replace_by));
 
@@ -472,8 +480,7 @@ replace_use_by (tree get_replaced, tree replace_by, bitmap need_eh_cleanup,
       fold_stmt (&gsi);
       cleanup_after_replace (use_stmt, gsi_stmt (gsi), need_eh_cleanup,
 			     need_ab_cleanup, stmts_to_fixup,
-			     false, false);
-      update_stmt (gsi_stmt (gsi));
+			     can_make_abnormal_goto, was_noreturn);
     }
 }
 
diff --git a/gcc/tree-ssa-propagate.cc b/gcc/tree-ssa-propagate.cc
index e0eeae70ece..01e125bb873 100644
--- a/gcc/tree-ssa-propagate.cc
+++ b/gcc/tree-ssa-propagate.cc
@@ -909,7 +909,6 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb)
 				 can_make_abnormal_goto, was_noreturn);
 
 	  /* Determine what needs to be done to update the SSA form.  */
-	  update_stmt_if_modified (stmt);
 	  if (!is_gimple_debug (stmt))
 	    something_changed = true;
 	}
@@ -1316,6 +1315,8 @@ cleanup_after_replace (gimple *old_stmt, gimple *stmt, bitmap need_eh_cleanup,
       if (TREE_CODE (rhs) == ADDR_EXPR)
 	recompute_tree_invariant_for_addr_expr (rhs);
     }
+
+  update_stmt_if_modified (stmt);
 }
 
 /* TODO Comment.  */

                 reply	other threads:[~2023-03-02 12:13 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=20230302121320.B7D6F3858D33@sourceware.org \
    --to=pheeck@gcc.gnu.org \
    --cc=gcc-cvs@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).