]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Improve BB vectorization opt-info
authorRichard Biener <rguenther@suse.de>
Fri, 11 Aug 2023 10:08:10 +0000 (12:08 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 11 Aug 2023 11:07:37 +0000 (13:07 +0200)
The following makes us more correctly print the used vector size
when doing BB vectorization and also print all involved SLP graph
roots, not just the random one we ended up picking as leader.
In particular the last bit improves diffing opt-info between
different GCC revs but it also requires some testsuite adjustments.

* tree-vect-slp.cc (vect_slp_region): Provide opt-info for all SLP
subgraph entries.  Dump the used vector size based on the
SLP subgraph entry root vector type.

* g++.dg/vect/slp-pr87105.cc: Adjust.
* gcc.dg/vect/bb-slp-17.c: Likewise.
* gcc.dg/vect/bb-slp-20.c: Likewise.
* gcc.dg/vect/bb-slp-21.c: Likewise.
* gcc.dg/vect/bb-slp-22.c: Likewise.
* gcc.dg/vect/bb-slp-subgroups-2.c: Likewise.

gcc/testsuite/g++.dg/vect/slp-pr87105.cc
gcc/testsuite/gcc.dg/vect/bb-slp-17.c
gcc/testsuite/gcc.dg/vect/bb-slp-20.c
gcc/testsuite/gcc.dg/vect/bb-slp-21.c
gcc/testsuite/gcc.dg/vect/bb-slp-22.c
gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-2.c
gcc/tree-vect-slp.cc

index d07b1cd46b7703e03f040a08f14d612e559a7569..17017686792b30fae0bb3d8f06e87c7dd74a9952 100644 (file)
@@ -99,7 +99,7 @@ void quadBoundingBoxA(const Point bez[3], Box& bBox) noexcept {
 
 // We should have if-converted everything down to straight-line code
 // { dg-final { scan-tree-dump-times "<bb \[0-9\]+>" 1 "slp2" } }
-// { dg-final { scan-tree-dump-times "basic block part vectorized" 1 "slp2" { xfail { { ! vect_element_align } && { ! vect_hw_misalign } } } } }
+// { dg-final { scan-tree-dump-times "Basic block will be vectorized using SLP" 1 "slp2" { xfail { { ! vect_element_align } && { ! vect_hw_misalign } } } } }
 // It's a bit awkward to detect that all stores were vectorized but the
 // following more or less does the trick
 // { dg-final { scan-tree-dump "vect_\[^\r\m\]* = MIN" "slp2" { xfail { { ! vect_element_align } && { ! vect_hw_misalign } } } } }
index fc3ef42f51a68acdece397ed4dcfda2826240d6b..e7bb06bf816709b5103d1d2fd9eff1c2ba7b77ef 100644 (file)
@@ -58,5 +58,6 @@ int main (void)
 }
 
 /* We need V2SI vector add support for the b[] vectorization, if we don't
-   have that we might only see the store vectorized and thus 2 subgraphs.  */
-/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target { vect_int_mult && vect64 } } } } */
+   have that we might only see the store vectorized.  In any case we have
+   two subgraph entries.  */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" { target { vect_int_mult && vect64 } } } } */
index 134858c934a493586fe83ccc0baf61432169ff62..7b25f91fbd3d0005acee00f13f741abdb7d94de8 100644 (file)
@@ -63,6 +63,7 @@ int main (void)
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_int_mult } } } */
+/* { dg-final { scan-tree-dump-times "Basic block will be vectorized using SLP" 1 "slp2" { target vect_int_mult } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" { target vect_int_mult } } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "slp2" { target vect_int_mult } } } */
   
index d4c98d67f551c0056efa98595b5fbb41ddf45522..45054cd3c295d01ec0daed9b91c87e6183f4421a 100644 (file)
@@ -63,6 +63,7 @@ int main (void)
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2"  } } */
+/* { dg-final { scan-tree-dump-times "Basic block will be vectorized using SLP" 1 "slp2"  } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2"  } } */
 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "slp2" } } */
   
index 92cc2a51abd0a2d004ada88512aa5a29e9e0e896..7bf7e2c4febbf74889cd6af103c0aa8a7e1ed748 100644 (file)
@@ -63,5 +63,5 @@ int main (void)
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "Basic block will be vectorized using SLP" 1 "slp2" } } */
 /* { dg-final { scan-tree-dump "vectorizing SLP node starting from: _\[0-9\]+ = _\[0-9\]+ \\\* a0" "slp2" { target vect_int_mult  } } } */
index 968cdf1cc515301c4fbb9981b60dee72c34e237e..ead8d92f202eb3a2f532a16bd5e6c860d0a093ea 100644 (file)
@@ -39,4 +39,4 @@ main (int argc, char **argv)
 }
 
 /* { dg-final { scan-tree-dump-times "Basic block will be vectorized using SLP" 1 "slp2" } } */
-/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" } } */
index f02921564c9d9bfb70ef73856433ebb4e241f7d8..41997d5a5467ec97a36ee20704d8fe69cf6d17a1 100644 (file)
@@ -7574,25 +7574,34 @@ vect_slp_region (vec<basic_block> bbs, vec<data_reference_p> datarefs,
                                 "using SLP\n");
              vectorized = true;
 
+             /* Dump before scheduling as store vectorization will remove
+                the original stores and mess with the instance tree
+                so querying its location will eventually ICE.  */
+             if (flag_checking)
+               for (slp_instance sub : instance->subgraph_entries)
+                 gcc_assert (SLP_TREE_VECTYPE (SLP_INSTANCE_TREE (sub)));
+             unsigned HOST_WIDE_INT bytes;
+             if (dump_enabled_p ())
+               for (slp_instance sub : instance->subgraph_entries)
+                 {
+                   tree vtype = SLP_TREE_VECTYPE (SLP_INSTANCE_TREE (sub));
+                   if (GET_MODE_SIZE (TYPE_MODE (vtype)).is_constant (&bytes))
+                     dump_printf_loc (MSG_OPTIMIZED_LOCATIONS,
+                                      sub->location (),
+                                      "basic block part vectorized using %wu "
+                                      "byte vectors\n", bytes);
+                   else
+                     dump_printf_loc (MSG_OPTIMIZED_LOCATIONS,
+                                      sub->location (),
+                                      "basic block part vectorized using "
+                                      "variable length vectors\n");
+                 }
+
              dump_user_location_t saved_vect_location = vect_location;
              vect_location = instance->location ();
 
              vect_schedule_slp (bb_vinfo, instance->subgraph_entries);
 
-             unsigned HOST_WIDE_INT bytes;
-             if (dump_enabled_p ())
-               {
-                 if (GET_MODE_SIZE
-                       (bb_vinfo->vector_mode).is_constant (&bytes))
-                   dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
-                                    "basic block part vectorized using %wu "
-                                    "byte vectors\n", bytes);
-                 else
-                   dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
-                                    "basic block part vectorized using "
-                                    "variable length vectors\n");
-               }
-
              vect_location = saved_vect_location;
            }
        }