public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/guojiufu/heads/personal-branch)] check SSA_NAME before get stmt
@ 2021-06-04 12:06 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2021-06-04 12:06 UTC (permalink / raw)
  To: gcc-cvs

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

commit dc96ca531a2f79b99f942b98b3660fa8e2b672ab
Author: guojiufu <guojiufu@linux.ibm.com>
Date:   Thu Jun 3 18:39:47 2021 +0800

    check SSA_NAME before get stmt

Diff:
---
 gcc/tree-ssa-loop-split.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c
index a35a7d19814..7df406e72fb 100644
--- a/gcc/tree-ssa-loop-split.c
+++ b/gcc/tree-ssa-loop-split.c
@@ -1614,6 +1614,7 @@ static gimple *
 filter_conversions (class loop *loop, tree idx, tree *small_type = NULL,
 		    tree *large_type = NULL)
 {
+  gcc_assert (TREE_CODE (idx) == SSA_NAME);
   gimple *stmt = SSA_NAME_DEF_STMT (idx);
   while (is_gimple_assign (stmt)
 	 && flow_bb_inside_loop_p (loop, gimple_bb (stmt)))
@@ -1705,10 +1706,18 @@ get_wrap_assumption (class loop *loop, edge *exit)
       /* Get the phi for idx.  */
       gimple *stmt = filter_conversions (loop, idx);
       if (is_gimple_assign (stmt))
-	stmt = filter_conversions (loop, gimple_assign_rhs1 (stmt));
-      if (gimple_code (stmt) != GIMPLE_PHI)
+	{
+	  tree rhs = gimple_assign_rhs1 (stmt);
+	  if (TREE_CODE (rhs) != SSA_NAME)
+	    continue;
+	  stmt = filter_conversions (loop, rhs);
+	}
+      if (gimple_code (stmt) != GIMPLE_PHI || gimple_bb (stmt) != loop->header)
 	continue;
       gphi *idx_phi = as_a<gphi *> (stmt);
+      tree next = PHI_ARG_DEF_FROM_EDGE (idx_phi, loop_latch_edge (loop));
+      if (TREE_CODE (next) != SSA_NAME)
+	continue;
 
       /* Check if idx is iv with base and step.  */
       affine_iv iv;
@@ -1722,7 +1731,6 @@ get_wrap_assumption (class loop *loop, edge *exit)
 
       /* If there is conversions on idx,
 	 Get the longest and shortest type during converting.  */
-      tree next = PHI_ARG_DEF_FROM_EDGE (idx_phi, loop_latch_edge (loop));
       tree small_type = TREE_TYPE (next);
       tree large_type = small_type;
       stmt = filter_conversions (loop, next, &small_type, &large_type);
@@ -1731,6 +1739,8 @@ get_wrap_assumption (class loop *loop, edge *exit)
 	  || !flow_bb_inside_loop_p (loop, gimple_bb (stmt)))
 	continue;
       tree prev = gimple_assign_rhs1 (stmt);
+      if (TREE_CODE (prev) != SSA_NAME)
+	continue;
       stmt = filter_conversions (loop, prev, &small_type, &large_type);
 
       /* Update the type of bae, bound and the max value of boundary.  */
@@ -1768,6 +1778,7 @@ get_wrap_assumption (class loop *loop, edge *exit)
 static bool
 update_idx_bnd_type (class loop *loop, edge e)
 {
+  return false;
   /* Get bnd and idx from gcond.  */
   gimple *last = last_stmt (e->src);
   if (!last || gimple_code (last) != GIMPLE_COND)
@@ -1790,11 +1801,13 @@ update_idx_bnd_type (class loop *loop, edge e)
      And check the exit gcond is comparing on the prev or next.  */
   gimple *inc_stmt = NULL;
   bool cmp_next = false;
+  gcc_assert (TREE_CODE (idx) == SSA_NAME);  
   gimple *stmt = filter_conversions (loop, idx);
   if (gimple_code (stmt) == GIMPLE_PHI)
     {
       idx_phi = as_a <gphi *> (stmt);
       next = PHI_ARG_DEF_FROM_EDGE (idx_phi, latch_e);
+      gcc_assert (TREE_CODE (next) == SSA_NAME);
       inc_stmt = filter_conversions (loop, next);
       cmp_next = false;
     }
@@ -1803,7 +1816,9 @@ update_idx_bnd_type (class loop *loop, edge e)
       inc_stmt = stmt;
       if (!is_gimple_assign (inc_stmt))
 	return false;
-      stmt = filter_conversions (loop, gimple_assign_rhs1 (stmt));
+      tree rhs =  gimple_assign_rhs1 (stmt);
+      gcc_assert (TREE_CODE (rhs) == SSA_NAME);
+      stmt = filter_conversions (loop, rhs);
       if (gimple_code (stmt) != GIMPLE_PHI)
 	return false;
       idx_phi = as_a<gphi *> (stmt);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-04 12:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 12:06 [gcc(refs/users/guojiufu/heads/personal-branch)] check SSA_NAME before get stmt Jiu Fu Guo

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