public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/pheeck/heads/sccp)] updating OCCURS_IN_ABNORMAL_PHI
@ 2022-09-07 12:59 Filip Kastl
  0 siblings, 0 replies; 2+ messages in thread
From: Filip Kastl @ 2022-09-07 12:59 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4f05f070963fb2e48f3e1f6c708a9e87a775d313

commit 4f05f070963fb2e48f3e1f6c708a9e87a775d313
Author: Filip Kastl <filip.kastl@gmail.com>
Date:   Wed Sep 7 14:59:06 2022 +0200

    updating OCCURS_IN_ABNORMAL_PHI

Diff:
---
 gcc/sccp.cc | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/gcc/sccp.cc b/gcc/sccp.cc
index fd7f01db6b3..86f84b56878 100644
--- a/gcc/sccp.cc
+++ b/gcc/sccp.cc
@@ -295,23 +295,26 @@ tarjan_compute_sccs (auto_vec<gphi *> &phis)
 }
 
 static void
-replace_scc_by_value (vec<gphi *> scc, tree v)
+replace_scc_by_value (vec<gphi *> scc, tree replace_by)
 {
   // DEBUG
+  /*
   if (scc.length () >= 3)
     {
       std::cerr << "Replacing scc of size " << scc.length () << std::endl;
     }
+  */
 
   for (gphi *phi : scc)
     {
-      tree ssa_name = gimple_get_lhs (phi);
+      tree get_replaced = gimple_get_lhs (phi);
 
       // DEBUG
-      unsigned vnum_get_replaced = SSA_NAME_VERSION (ssa_name);
-      if (TREE_CODE (v) == SSA_NAME)
+      /*
+      unsigned vnum_get_replaced = SSA_NAME_VERSION (get_replaced);
+      if (TREE_CODE (replace_by) == SSA_NAME)
 	{
-	  unsigned vnum_replaced_by = SSA_NAME_VERSION (v);
+	  unsigned vnum_replaced_by = SSA_NAME_VERSION (replace_by);
 	  std::cerr << "Replacing " << vnum_get_replaced << " by " <<
 	    vnum_replaced_by << std::endl;
 	}
@@ -320,15 +323,20 @@ replace_scc_by_value (vec<gphi *> scc, tree v)
 	  std::cerr << "Replacing " << vnum_get_replaced << " by something"
 	    << " that isn't an SSA name" << std::endl;
 	}
+      */
+
+      if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (get_replaced)
+	  && TREE_CODE (replace_by) == SSA_NAME)
+	SSA_NAME_OCCURS_IN_ABNORMAL_PHI (replace_by) = 1;
 
-      /* Replace each occurence of phi by value v.  */
+      /* Replace each occurence of PHI by value replace_by.  */
       use_operand_p use_p;
       imm_use_iterator iter;
       gimple *use_stmt;
-      FOR_EACH_IMM_USE_STMT (use_stmt, iter, ssa_name)
+      FOR_EACH_IMM_USE_STMT (use_stmt, iter, get_replaced)
 	{
 	  FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
-	    SET_USE (use_p, v);
+	    SET_USE (use_p, replace_by);
 	  update_stmt (use_stmt);
 	}
     }
@@ -353,8 +361,10 @@ remove_zero_uses_phis ()
 	      remove_phi_node (&pi, true);
 
 	      // DEBUG
+	      /*
 	      unsigned version = SSA_NAME_VERSION (ssa_name);
 	      std::cerr << "Removed " << version << std::endl;
+	      */
 	    }
 	  else
 	    gsi_next (&pi);
@@ -480,7 +490,7 @@ public:
 unsigned
 pass_sccp::execute (function *)
 {
-  debug_phis (); // DEBUG
+  //debug_phis (); // DEBUG
 
   init_sccp ();
   auto_vec<gphi *> phis = get_all_phis ();

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/users/pheeck/heads/sccp)] updating OCCURS_IN_ABNORMAL_PHI
@ 2023-02-15 10:14 Filip Kastl
  0 siblings, 0 replies; 2+ messages in thread
From: Filip Kastl @ 2023-02-15 10:14 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:8b2b361630a4a3053ee90210e63bf41c3ff27a0e

commit 8b2b361630a4a3053ee90210e63bf41c3ff27a0e
Author: Filip Kastl <filip.kastl@gmail.com>
Date:   Wed Sep 7 14:59:06 2022 +0200

    updating OCCURS_IN_ABNORMAL_PHI

Diff:
---
 gcc/sccp.cc | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/gcc/sccp.cc b/gcc/sccp.cc
index fd7f01db6b3..86f84b56878 100644
--- a/gcc/sccp.cc
+++ b/gcc/sccp.cc
@@ -295,23 +295,26 @@ tarjan_compute_sccs (auto_vec<gphi *> &phis)
 }
 
 static void
-replace_scc_by_value (vec<gphi *> scc, tree v)
+replace_scc_by_value (vec<gphi *> scc, tree replace_by)
 {
   // DEBUG
+  /*
   if (scc.length () >= 3)
     {
       std::cerr << "Replacing scc of size " << scc.length () << std::endl;
     }
+  */
 
   for (gphi *phi : scc)
     {
-      tree ssa_name = gimple_get_lhs (phi);
+      tree get_replaced = gimple_get_lhs (phi);
 
       // DEBUG
-      unsigned vnum_get_replaced = SSA_NAME_VERSION (ssa_name);
-      if (TREE_CODE (v) == SSA_NAME)
+      /*
+      unsigned vnum_get_replaced = SSA_NAME_VERSION (get_replaced);
+      if (TREE_CODE (replace_by) == SSA_NAME)
 	{
-	  unsigned vnum_replaced_by = SSA_NAME_VERSION (v);
+	  unsigned vnum_replaced_by = SSA_NAME_VERSION (replace_by);
 	  std::cerr << "Replacing " << vnum_get_replaced << " by " <<
 	    vnum_replaced_by << std::endl;
 	}
@@ -320,15 +323,20 @@ replace_scc_by_value (vec<gphi *> scc, tree v)
 	  std::cerr << "Replacing " << vnum_get_replaced << " by something"
 	    << " that isn't an SSA name" << std::endl;
 	}
+      */
+
+      if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (get_replaced)
+	  && TREE_CODE (replace_by) == SSA_NAME)
+	SSA_NAME_OCCURS_IN_ABNORMAL_PHI (replace_by) = 1;
 
-      /* Replace each occurence of phi by value v.  */
+      /* Replace each occurence of PHI by value replace_by.  */
       use_operand_p use_p;
       imm_use_iterator iter;
       gimple *use_stmt;
-      FOR_EACH_IMM_USE_STMT (use_stmt, iter, ssa_name)
+      FOR_EACH_IMM_USE_STMT (use_stmt, iter, get_replaced)
 	{
 	  FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
-	    SET_USE (use_p, v);
+	    SET_USE (use_p, replace_by);
 	  update_stmt (use_stmt);
 	}
     }
@@ -353,8 +361,10 @@ remove_zero_uses_phis ()
 	      remove_phi_node (&pi, true);
 
 	      // DEBUG
+	      /*
 	      unsigned version = SSA_NAME_VERSION (ssa_name);
 	      std::cerr << "Removed " << version << std::endl;
+	      */
 	    }
 	  else
 	    gsi_next (&pi);
@@ -480,7 +490,7 @@ public:
 unsigned
 pass_sccp::execute (function *)
 {
-  debug_phis (); // DEBUG
+  //debug_phis (); // DEBUG
 
   init_sccp ();
   auto_vec<gphi *> phis = get_all_phis ();

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-15 10:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07 12:59 [gcc(refs/users/pheeck/heads/sccp)] updating OCCURS_IN_ABNORMAL_PHI Filip Kastl
2023-02-15 10:14 Filip Kastl

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).