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)] corrected handling of abnormal phis
Date: Mon,  5 Sep 2022 09:53:18 +0000 (GMT)	[thread overview]
Message-ID: <20220905095318.571733858D32@sourceware.org> (raw)

https://gcc.gnu.org/g:5b14058a7bad4457c73540eb62139dfebfe952b1

commit 5b14058a7bad4457c73540eb62139dfebfe952b1
Author: Filip Kastl <filip.kastl@gmail.com>
Date:   Mon Sep 5 11:53:10 2022 +0200

    corrected handling of abnormal phis

Diff:
---
 gcc/sccp.cc | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/gcc/sccp.cc b/gcc/sccp.cc
index 1ac4474c019..bcb3b313782 100644
--- a/gcc/sccp.cc
+++ b/gcc/sccp.cc
@@ -126,11 +126,10 @@ finalize_sccp (void)
 {
 }
 
-/* Return vector of all PHI functions available to this pass that aren't
-   abnormal.  */
+/* Return vector of all PHI functions from all basic blocks.  */
 
 static vec<gphi *>
-get_all_normal_phis (void)
+get_all_phis (void)
 {
   vec<gphi *> result = vNULL;
 
@@ -141,9 +140,6 @@ get_all_normal_phis (void)
       for (pi = gsi_start_phis (bb); !gsi_end_p (pi); gsi_next (&pi))
 	{
 	  gphi *phi = pi.phi ();
-	  tree ssa_name = gimple_phi_result (phi);
-	  if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ssa_name))
-	    continue;
 	  result.safe_push (phi);
 	}
     }
@@ -423,7 +419,10 @@ process_scc (vec<gphi *> scc)
 	  break;
 	}
 
-      replace_scc_by_value (scc, outer_op);
+      /* Only replace by non-abnormal phi.  */
+      if (!(TREE_CODE (outer_op) == SSA_NAME &&
+	  SSA_NAME_OCCURS_IN_ABNORMAL_PHI (outer_op)))
+	replace_scc_by_value (scc, outer_op);
     }
   else if (outer_ops.elements () > 1)
     {
@@ -476,7 +475,7 @@ unsigned
 pass_sccp::execute (function *)
 {
   init_sccp ();
-  remove_redundant_phis (get_all_normal_phis ());
+  remove_redundant_phis (get_all_phis ());
   finalize_sccp ();
 
   return 0;

             reply	other threads:[~2022-09-05  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05  9:53 Filip Kastl [this message]
2023-02-15 10:14 Filip Kastl

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=20220905095318.571733858D32@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).