tree-vect-slp.c (vect_analyze_slp_instance): Dump constructors we are actually analyzing.
authorRichard Biener <rguenther@suse.de>
Wed, 20 Nov 2019 11:12:48 +0000 (11:12 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 20 Nov 2019 11:12:48 +0000 (11:12 +0000)
2019-11-20  Richard Biener  <rguenther@suse.de>

* tree-vect-slp.c (vect_analyze_slp_instance): Dump
constructors we are actually analyzing.
(vect_slp_check_for_constructors): Do not vectorize uniform
constuctors, do not dump here.

* gcc.dg/vect/bb-slp-42.c: Adjust.
* gcc.dg/vect/bb-slp-40.c: Likewise.

From-SVN: r278495

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/bb-slp-40.c
gcc/testsuite/gcc.dg/vect/bb-slp-42.c
gcc/tree-vect-slp.c

index 796056ed9458e4efe93cba6a6b6d2019aed200a6..eacaee3638c95be3c3a9a479de24f6f9da4f44fc 100644 (file)
@@ -1,3 +1,10 @@
+2019-11-20  Richard Biener  <rguenther@suse.de>
+
+       * tree-vect-slp.c (vect_analyze_slp_instance): Dump
+       constructors we are actually analyzing.
+       (vect_slp_check_for_constructors): Do not vectorize uniform
+       constuctors, do not dump here.
+
 2019-11-20  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/92537
index a4de5d1e0b730e08365e591054c5696841b4f73c..057b5d609acd2805cfa1bd6031fd1d19fae399d4 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-20  Richard Biener  <rguenther@suse.de>
+
+       * gcc.dg/vect/bb-slp-42.c: Adjust.
+       * gcc.dg/vect/bb-slp-40.c: Likewise.
+
 2019-11-20  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/92537
index ecdaf830c12d60b0c1470175dfcecaad27972e47..ce5a75c979caf75913ba5cb0e994040d6d30f948 100644 (file)
@@ -30,5 +30,5 @@ void foo(void)
 }
 
 /* See that we vectorize an SLP instance.  */
-/* { dg-final { scan-tree-dump "Found vectorizable constructor" "slp1" } } */
+/* { dg-final { scan-tree-dump "Analyzing vectorizable constructor" "slp1" } } */
 /* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "slp1" } } */
index 091a273d2afe64e8e68c322bb875737a9f62e547..1dfa301184aad4c8edf00af80fb861562c941049 100644 (file)
@@ -44,6 +44,5 @@ main ()
 
 }
 
-/* See that we vectorize an SLP instance.  */
-/* { dg-final { scan-tree-dump "Found vectorizable constructor" "slp1" { target { ! vect_fully_masked } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "slp1" { target { ! vect_fully_masked } } } } */
+/* See that we do not try to vectorize the uniform CTORs.  */
+/* { dg-final { scan-tree-dump-not "Analyzing vectorizable constructor" "slp1" } } */
index 75d788051c1a3e64c0e59a583caecc456cdb0164..36ea0b1dffb70b905ef1e9f80cdc6d6344d4c53b 100644 (file)
@@ -2183,6 +2183,10 @@ vect_analyze_slp_instance (vec_info *vinfo,
          else
            return false;
        }
+      if (dump_enabled_p ())
+       dump_printf_loc (MSG_NOTE, vect_location,
+                        "Analyzing vectorizable constructor: %G\n",
+                        stmt_info->stmt);
     }
   else
     {
@@ -3116,31 +3120,22 @@ vect_slp_check_for_constructors (bb_vec_info bb_vinfo)
   gimple_stmt_iterator gsi;
 
   for (gsi = bb_vinfo->region_begin;
-      gsi_stmt (gsi) != gsi_stmt (bb_vinfo->region_end); gsi_next (&gsi))
+       gsi_stmt (gsi) != gsi_stmt (bb_vinfo->region_end); gsi_next (&gsi))
     {
-      gimple *stmt = gsi_stmt (gsi);
-
-      if (is_gimple_assign (stmt)
-         && gimple_assign_rhs_code (stmt) == CONSTRUCTOR
-         && TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME
-         && TREE_CODE (TREE_TYPE (gimple_assign_lhs (stmt))) == VECTOR_TYPE)
-       {
-         tree rhs = gimple_assign_rhs1 (stmt);
-
-         if (CONSTRUCTOR_NELTS (rhs) == 0)
-           continue;
-
-         poly_uint64 subparts = TYPE_VECTOR_SUBPARTS (TREE_TYPE (rhs));
+      gassign *stmt = dyn_cast <gassign *> (gsi_stmt (gsi));
+      if (!stmt || gimple_assign_rhs_code (stmt) != CONSTRUCTOR)
+       continue;
 
-         if (maybe_ne (subparts, CONSTRUCTOR_NELTS (rhs)))
-           continue;
+      tree rhs = gimple_assign_rhs1 (stmt);
+      if (!VECTOR_TYPE_P (TREE_TYPE (rhs))
+         || maybe_ne (TYPE_VECTOR_SUBPARTS (TREE_TYPE (rhs)),
+                      CONSTRUCTOR_NELTS (rhs))
+         || VECTOR_TYPE_P (TREE_TYPE (CONSTRUCTOR_ELT (rhs, 0)->value))
+         || uniform_vector_p (rhs))
+       continue;
 
-         if (dump_enabled_p ())
-           dump_printf_loc (MSG_NOTE, vect_location,
-                            "Found vectorizable constructor: %G\n", stmt);
-         stmt_vec_info stmt_info = bb_vinfo->lookup_stmt (stmt);
-         BB_VINFO_GROUPED_STORES (bb_vinfo).safe_push (stmt_info);
-       }
+      stmt_vec_info stmt_info = bb_vinfo->lookup_stmt (stmt);
+      BB_VINFO_GROUPED_STORES (bb_vinfo).safe_push (stmt_info);
     }
 }