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

https://gcc.gnu.org/g:d0786c70d75b78a35e4cf723be921ccf09657bec

commit d0786c70d75b78a35e4cf723be921ccf09657bec
Author: Filip Kastl <filip.kastl@gmail.com>
Date:   Wed Sep 7 11:33:11 2022 +0200

    added call to update_gimple_stmt ()

Diff:
---
 gcc/sccp.cc | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/gcc/sccp.cc b/gcc/sccp.cc
index 32072c5d6d2..fd7f01db6b3 100644
--- a/gcc/sccp.cc
+++ b/gcc/sccp.cc
@@ -297,23 +297,40 @@ tarjan_compute_sccs (auto_vec<gphi *> &phis)
 static void
 replace_scc_by_value (vec<gphi *> scc, tree v)
 {
+  // 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);
 
       // DEBUG
       unsigned vnum_get_replaced = SSA_NAME_VERSION (ssa_name);
-      unsigned vnum_replaced_by = SSA_NAME_VERSION (v);
-      std::cerr << "Replacing " << vnum_get_replaced << " by " <<
-	vnum_replaced_by << std::endl;
+      if (TREE_CODE (v) == SSA_NAME)
+	{
+	  unsigned vnum_replaced_by = SSA_NAME_VERSION (v);
+	  std::cerr << "Replacing " << vnum_get_replaced << " by " <<
+	    vnum_replaced_by << std::endl;
+	}
+      else
+	{
+	  std::cerr << "Replacing " << vnum_get_replaced << " by something"
+	    << " that isn't an SSA name" << std::endl;
+	}
 
       /* Replace each occurence of phi by value v.  */
       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_ON_STMT (use_p, iter)
-	  SET_USE (use_p, v);
+	{
+	  FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
+	    SET_USE (use_p, v);
+	  update_stmt (use_stmt);
+	}
     }
 }
 
@@ -463,7 +480,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)] added call to update_gimple_stmt ()
@ 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:c10b09ae87abfe6af1e55937a00e2c48bed9ca94

commit c10b09ae87abfe6af1e55937a00e2c48bed9ca94
Author: Filip Kastl <filip.kastl@gmail.com>
Date:   Wed Sep 7 11:33:11 2022 +0200

    added call to update_gimple_stmt ()

Diff:
---
 gcc/sccp.cc | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/gcc/sccp.cc b/gcc/sccp.cc
index 32072c5d6d2..fd7f01db6b3 100644
--- a/gcc/sccp.cc
+++ b/gcc/sccp.cc
@@ -297,23 +297,40 @@ tarjan_compute_sccs (auto_vec<gphi *> &phis)
 static void
 replace_scc_by_value (vec<gphi *> scc, tree v)
 {
+  // 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);
 
       // DEBUG
       unsigned vnum_get_replaced = SSA_NAME_VERSION (ssa_name);
-      unsigned vnum_replaced_by = SSA_NAME_VERSION (v);
-      std::cerr << "Replacing " << vnum_get_replaced << " by " <<
-	vnum_replaced_by << std::endl;
+      if (TREE_CODE (v) == SSA_NAME)
+	{
+	  unsigned vnum_replaced_by = SSA_NAME_VERSION (v);
+	  std::cerr << "Replacing " << vnum_get_replaced << " by " <<
+	    vnum_replaced_by << std::endl;
+	}
+      else
+	{
+	  std::cerr << "Replacing " << vnum_get_replaced << " by something"
+	    << " that isn't an SSA name" << std::endl;
+	}
 
       /* Replace each occurence of phi by value v.  */
       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_ON_STMT (use_p, iter)
-	  SET_USE (use_p, v);
+	{
+	  FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
+	    SET_USE (use_p, v);
+	  update_stmt (use_stmt);
+	}
     }
 }
 
@@ -463,7 +480,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  9:33 [gcc(refs/users/pheeck/heads/sccp)] added call to update_gimple_stmt () 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).