tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Add assertion.
authorRichard Biener <rguenther@suse.de>
Mon, 25 Nov 2019 11:38:37 +0000 (11:38 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 25 Nov 2019 11:38:37 +0000 (11:38 +0000)
2019-11-25  Richard Biener  <rguenther@suse.de>

* tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Add assertion.
(vect_detect_hybrid_slp): Swap lane and instance iteration,
properly re-building the visited hash-map for each lane.

From-SVN: r278679

gcc/ChangeLog
gcc/tree-vect-slp.c

index 9b0169bb80daf45ec66f63404b22b12a886ede3c..6dee39e682386667ce10714d8bcf88eacafed20b 100644 (file)
@@ -1,3 +1,9 @@
+2019-11-25  Richard Biener  <rguenther@suse.de>
+
+       * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Add assertion.
+       (vect_detect_hybrid_slp): Swap lane and instance iteration,
+       properly re-building the visited hash-map for each lane.
+
 2019-11-25  Tobias Burnus  <tobias@codesourcery.com>
 
        * config/gcn/gcn.c (gcn_expand_scalar_to_vector_address,
index a94d2d42491dfc4bbadd4b75484326e54e459e23..bedbe9ac978fa0468ba6a3350e655003f2210ae9 100644 (file)
@@ -2542,7 +2542,9 @@ vect_detect_hybrid_slp_stmts (slp_tree node, unsigned i, slp_vect_type stype,
 
   /* We need to union stype over the incoming graph edges but we still
      want to limit recursion to stay O(N+E).  */
-  bool only_edge = (++visited.get_or_insert (node) < node->refcnt);
+  unsigned visited_cnt = ++visited.get_or_insert (node);
+  gcc_assert (visited_cnt <= node->refcnt);
+  bool only_edge = (visited_cnt != node->refcnt);
 
   /* Propagate hybrid down the SLP tree.  */
   if (stype == hybrid)
@@ -2680,12 +2682,19 @@ vect_detect_hybrid_slp (loop_vec_info loop_vinfo)
   /* Then walk the SLP instance trees marking stmts with uses in
      non-SLP stmts as hybrid, also propagating hybrid down the
      SLP tree, collecting the above info on-the-fly.  */
-  hash_map<slp_tree, unsigned> visited;
-  FOR_EACH_VEC_ELT (slp_instances, i, instance)
+  for (unsigned j = 0;; ++j)
     {
-      for (unsigned i = 0; i < SLP_INSTANCE_GROUP_SIZE (instance); ++i)
-       vect_detect_hybrid_slp_stmts (SLP_INSTANCE_TREE (instance),
-                                     i, pure_slp, visited);
+      hash_map<slp_tree, unsigned> visited;
+      bool any = false;
+      FOR_EACH_VEC_ELT (slp_instances, i, instance)
+       if (j < SLP_INSTANCE_GROUP_SIZE (instance))
+         {
+           any = true;
+           vect_detect_hybrid_slp_stmts (SLP_INSTANCE_TREE (instance),
+                                         j, pure_slp, visited);
+         }
+      if (!any)
+       break;
     }
 }