tree-vect-stmts.c (vectorizable_conversion): Do not set STMT_VINFO_VEC_STMT for SLP.
authorRichard Biener <rguenther@suse.de>
Thu, 25 Jun 2015 12:36:12 +0000 (12:36 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 25 Jun 2015 12:36:12 +0000 (12:36 +0000)
2015-06-25  Richard Biener  <rguenther@suse.de>

* tree-vect-stmts.c (vectorizable_conversion): Do not set
STMT_VINFO_VEC_STMT for SLP.
(vectorizable_store): Likewise.
(vectorizable_load): Likewise.
(vect_transform_stmt): Catch SLP vectorization clobbering
STMT_VINFO_VEC_STMT.

From-SVN: r224939

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

index e5f1278c44621f7ce6ee02cb179159979081c317..86a3b36152616e39d0174efb8b1711546b738914 100644 (file)
@@ -1,3 +1,12 @@
+2015-06-25  Richard Biener  <rguenther@suse.de>
+
+       * tree-vect-stmts.c (vectorizable_conversion): Do not set
+       STMT_VINFO_VEC_STMT for SLP.
+       (vectorizable_store): Likewise.
+       (vectorizable_load): Likewise.
+       (vect_transform_stmt): Catch SLP vectorization clobbering
+       STMT_VINFO_VEC_STMT.
+
 2015-06-25  Richard Biener  <rguenther@suse.de>
 
        * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Improve debug
index cac4768af0bbfb183c3e05c2cff5babfad5a9849..dbcd4879f8058400a2d90b27525c55c41077bc05 100644 (file)
@@ -3841,13 +3841,15 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
              vect_finish_stmt_generation (stmt, new_stmt, gsi);
              if (slp_node)
                SLP_TREE_VEC_STMTS (slp_node).quick_push (new_stmt);
+             else
+               {
+                 if (!prev_stmt_info)
+                   STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt;
+                 else
+                   STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
+                 prev_stmt_info = vinfo_for_stmt (new_stmt);
+               }
            }
-
-         if (j == 0)
-           STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt;
-         else
-           STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
-         prev_stmt_info = vinfo_for_stmt (new_stmt);
        }
       break;
 
@@ -5400,10 +5402,12 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
                  vect_finish_stmt_generation (stmt, incr, gsi);
 
                  running_off = newoff;
-                 if (g == group_size - 1)
+                 if (g == group_size - 1
+                     && !slp)
                    {
                      if (j == 0 && i == 0)
-                       STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = assign;
+                       STMT_VINFO_VEC_STMT (stmt_info)
+                           = *vec_stmt = assign;
                      else
                        STMT_VINFO_RELATED_STMT (prev_stmt_info) = assign;
                      prev_stmt_info = vinfo_for_stmt (assign);
@@ -6409,11 +6413,14 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
              if (slp_perm)
                dr_chain.quick_push (gimple_assign_lhs (new_stmt));
            }
-         if (j == 0)
-           STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt;
          else
-           STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
-         prev_stmt_info = vinfo_for_stmt (new_stmt);
+           {
+             if (j == 0)
+               STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt;
+             else
+               STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
+             prev_stmt_info = vinfo_for_stmt (new_stmt);
+           }
        }
       if (slp_perm)
        vect_transform_slp_perm_load (slp_node, dr_chain, gsi, vf,
@@ -7523,6 +7530,8 @@ vect_transform_stmt (gimple stmt, gimple_stmt_iterator *gsi,
   stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
   bool done;
 
+  gimple old_vec_stmt = STMT_VINFO_VEC_STMT (stmt_info);
+
   switch (STMT_VINFO_TYPE (stmt_info))
     {
     case type_demotion_vec_info_type:
@@ -7610,6 +7619,18 @@ vect_transform_stmt (gimple stmt, gimple_stmt_iterator *gsi,
        }
     }
 
+  /* Verify SLP vectorization doesn't mess with STMT_VINFO_VEC_STMT.
+     This would break hybrid SLP vectorization.  */
+  if (slp_node)
+    {
+      if (PURE_SLP_STMT (stmt_info))
+       gcc_assert (!old_vec_stmt && !vec_stmt
+                   && !STMT_VINFO_VEC_STMT (stmt_info));
+      else if (HYBRID_SLP_STMT (stmt_info))
+       gcc_assert (!vec_stmt
+                   && STMT_VINFO_VEC_STMT (stmt_info) == old_vec_stmt);
+    }
+
   /* Handle inner-loop stmts whose DEF is used in the loop-nest that
      is being vectorized, but outside the immediately enclosing loop.  */
   if (vec_stmt