The following moves BB vect live stmt marking out of
vect_slp_analyze_operations to vect_slp_analyze_bb_1 and SLP stmt marking,
marking some vectorized stmts as PURE_SLP, right before it which
is the only remaining consumer.

        * tree-vect-slp.cc (vect_slp_analyze_operations): Move
        vect_bb_slp_mark_live_stmts call ...
        (vect_slp_analyze_bb_1): ... here.  Move SLP stmt marking
        right before it.
        (vect_mark_slp_stmts): Remove unused overload.
---
 gcc/tree-vect-slp.cc | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 9d249f5fe4e..a611629f1dc 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -3492,13 +3492,6 @@ vect_mark_slp_stmts (vec_info *vinfo, slp_tree node,
       vect_mark_slp_stmts (vinfo, child, visited);
 }
 
-static void
-vect_mark_slp_stmts (vec_info *vinfo, slp_tree node)
-{
-  hash_set<slp_tree> visited;
-  vect_mark_slp_stmts (vinfo, node, visited);
-}
-
 /* Mark the statements of the tree rooted at NODE as relevant (vect_used).  */
 
 static void
@@ -9324,10 +9317,6 @@ vect_slp_analyze_operations (vec_info *vinfo)
          ++i;
     }
 
-  /* Compute vectorizable live stmts.  */
-  if (bb_vec_info bb_vinfo = dyn_cast <bb_vec_info> (vinfo))
-    vect_bb_slp_mark_live_stmts (bb_vinfo);
-
   return !vinfo->slp_instances.is_empty ();
 }
 
@@ -10265,15 +10254,8 @@ vect_slp_analyze_bb_1 (bb_vec_info bb_vinfo, int 
n_stmts, bool &fatal,
          continue;
        }
 
-      /* Mark all the statements that we want to vectorize as pure SLP and
-        relevant.  */
-      vect_mark_slp_stmts (bb_vinfo, SLP_INSTANCE_TREE (instance));
+      /* Mark all the statements that we want to vectorize as relevant.  */
       vect_mark_slp_stmts_relevant (SLP_INSTANCE_TREE (instance));
-      unsigned j;
-      stmt_vec_info root;
-      /* Likewise consider instance root stmts as vectorized.  */
-      FOR_EACH_VEC_ELT (SLP_INSTANCE_ROOT_STMTS (instance), j, root)
-       STMT_SLP_TYPE (root) = pure_slp;
 
       i++;
     }
@@ -10288,6 +10270,21 @@ vect_slp_analyze_bb_1 (bb_vec_info bb_vinfo, int 
n_stmts, bool &fatal,
       return false;
     }
 
+  /* Mark all the statements that we want to vectorize as pure SLP.  */
+  hash_set<slp_tree> visited;
+  for (auto instance : BB_VINFO_SLP_INSTANCES (bb_vinfo))
+    {
+      vect_mark_slp_stmts (bb_vinfo, SLP_INSTANCE_TREE (instance), visited);
+      unsigned j;
+      stmt_vec_info root;
+      /* Likewise consider instance root stmts as vectorized.  */
+      FOR_EACH_VEC_ELT (SLP_INSTANCE_ROOT_STMTS (instance), j, root)
+       STMT_SLP_TYPE (root) = pure_slp;
+    }
+
+  /* Compute vectorizable live stmts.  */
+  vect_bb_slp_mark_live_stmts (bb_vinfo);
+
   vect_bb_partition_graph (bb_vinfo);
 
   return true;
-- 
2.51.0

Reply via email to