public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/pheeck/heads/sccp)] add check for operands that aren't SSA names
@ 2022-09-02 11:26 Filip Kastl
  0 siblings, 0 replies; 2+ messages in thread
From: Filip Kastl @ 2022-09-02 11:26 UTC (permalink / raw)
  To: gcc-cvs

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

commit d971e7347969e6ad1956fac4fafc5dc59ecdd4e4
Author: Filip Kastl <filip.kastl@gmail.com>
Date:   Fri Sep 2 13:25:56 2022 +0200

    add check for operands that aren't SSA names

Diff:
---
 gcc/sccp.cc | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/gcc/sccp.cc b/gcc/sccp.cc
index 529307dbe27..8b57e3a4a3c 100644
--- a/gcc/sccp.cc
+++ b/gcc/sccp.cc
@@ -217,8 +217,11 @@ tarjan_compute_sccs (vec<gphi *> phis)
 	  unsigned j;
 	  for (j = 0; j < gimple_phi_num_args (phi); j++)
 	    {
-	      tree op_ssa = gimple_phi_arg_def (phi, j);
-	      gimple *op_stmt = SSA_NAME_DEF_STMT (op_ssa);
+	      tree op_var = gimple_phi_arg_def (phi, j);
+	      if (TREE_CODE (op_var) != SSA_NAME)
+		continue; /* Skip arguments that aren't SSA names.  */
+
+	      gimple *op_stmt = SSA_NAME_DEF_STMT (op_var);
 
 	      /* Skip any operand that isn't a vertex we're using.  */
 	      if (!tarjan_is_using (op_stmt))
@@ -254,9 +257,12 @@ tarjan_compute_sccs (vec<gphi *> phis)
 	  unsigned j;
 	  for (j = 0; j < gimple_phi_num_args (phi); j++)
 	    {
-	      tree op_ssa = gimple_phi_arg_def (phi, j); // TODO Same code
+	      tree op_var = gimple_phi_arg_def (phi, j); // TODO Same code
 							 // twice (iterator?)
-	      gimple *op_stmt = SSA_NAME_DEF_STMT (op_ssa);
+	      if (TREE_CODE (op_var) != SSA_NAME)
+		continue; /* Skip arguments that aren't SSA names.  */
+
+	      gimple *op_stmt = SSA_NAME_DEF_STMT (op_var);
 
 	      /* Skip any operand that isn't a vertex we're using.  */
 	      if (!tarjan_is_using (op_stmt))
@@ -342,6 +348,9 @@ process_scc (vec<gphi *> scc)
       for (i = 0; i < gimple_phi_num_args (phi); i++)
 	{
 	  tree op = gimple_phi_arg_def (phi, i);
+	  if (TREE_CODE (op) != SSA_NAME)
+	    continue; /* Skip arguments that aren't SSA names.  */
+
 	  gimple *op_stmt = SSA_NAME_DEF_STMT (op);
 
 	  // Check if operand is a phi from scc (TODO Efficiency)

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

* [gcc(refs/users/pheeck/heads/sccp)] add check for operands that aren't SSA names
@ 2023-02-15 10:13 Filip Kastl
  0 siblings, 0 replies; 2+ messages in thread
From: Filip Kastl @ 2023-02-15 10:13 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0d47194f8a5735a457a78830935d266353dfa1fe

commit 0d47194f8a5735a457a78830935d266353dfa1fe
Author: Filip Kastl <filip.kastl@gmail.com>
Date:   Fri Sep 2 13:25:56 2022 +0200

    add check for operands that aren't SSA names

Diff:
---
 gcc/sccp.cc | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/gcc/sccp.cc b/gcc/sccp.cc
index 529307dbe27..8b57e3a4a3c 100644
--- a/gcc/sccp.cc
+++ b/gcc/sccp.cc
@@ -217,8 +217,11 @@ tarjan_compute_sccs (vec<gphi *> phis)
 	  unsigned j;
 	  for (j = 0; j < gimple_phi_num_args (phi); j++)
 	    {
-	      tree op_ssa = gimple_phi_arg_def (phi, j);
-	      gimple *op_stmt = SSA_NAME_DEF_STMT (op_ssa);
+	      tree op_var = gimple_phi_arg_def (phi, j);
+	      if (TREE_CODE (op_var) != SSA_NAME)
+		continue; /* Skip arguments that aren't SSA names.  */
+
+	      gimple *op_stmt = SSA_NAME_DEF_STMT (op_var);
 
 	      /* Skip any operand that isn't a vertex we're using.  */
 	      if (!tarjan_is_using (op_stmt))
@@ -254,9 +257,12 @@ tarjan_compute_sccs (vec<gphi *> phis)
 	  unsigned j;
 	  for (j = 0; j < gimple_phi_num_args (phi); j++)
 	    {
-	      tree op_ssa = gimple_phi_arg_def (phi, j); // TODO Same code
+	      tree op_var = gimple_phi_arg_def (phi, j); // TODO Same code
 							 // twice (iterator?)
-	      gimple *op_stmt = SSA_NAME_DEF_STMT (op_ssa);
+	      if (TREE_CODE (op_var) != SSA_NAME)
+		continue; /* Skip arguments that aren't SSA names.  */
+
+	      gimple *op_stmt = SSA_NAME_DEF_STMT (op_var);
 
 	      /* Skip any operand that isn't a vertex we're using.  */
 	      if (!tarjan_is_using (op_stmt))
@@ -342,6 +348,9 @@ process_scc (vec<gphi *> scc)
       for (i = 0; i < gimple_phi_num_args (phi); i++)
 	{
 	  tree op = gimple_phi_arg_def (phi, i);
+	  if (TREE_CODE (op) != SSA_NAME)
+	    continue; /* Skip arguments that aren't SSA names.  */
+
 	  gimple *op_stmt = SSA_NAME_DEF_STMT (op);
 
 	  // Check if operand is a phi from scc (TODO Efficiency)

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-02 11:26 [gcc(refs/users/pheeck/heads/sccp)] add check for operands that aren't SSA names Filip Kastl
2023-02-15 10:13 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).