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)] add check for operands that aren't SSA names
Date: Fri,  2 Sep 2022 11:26:03 +0000 (GMT)	[thread overview]
Message-ID: <20220902112603.A46033858C54@sourceware.org> (raw)

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)

             reply	other threads:[~2022-09-02 11:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 11:26 Filip Kastl [this message]
2023-02-15 10:13 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=20220902112603.A46033858C54@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).