diff options
author | Richard Biener <rguenther@suse.de> | 2023-08-11 12:08:10 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-08-11 13:07:37 +0200 |
commit | 3a13884b23ae32b43d56d68a9c6bd4ce53d60017 (patch) | |
tree | a78f16962a6c947b0f652a19f0f1862707560c21 /gcc | |
parent | 6a8203b7dc0ab694c3f3f4aef503107975bb59aa (diff) | |
download | gcc-3a13884b23ae32b43d56d68a9c6bd4ce53d60017.zip gcc-3a13884b23ae32b43d56d68a9c6bd4ce53d60017.tar.gz gcc-3a13884b23ae32b43d56d68a9c6bd4ce53d60017.tar.bz2 |
Improve BB vectorization opt-info
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/g++.dg/vect/slp-pr87105.cc | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/bb-slp-17.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/bb-slp-20.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/bb-slp-21.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/bb-slp-22.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-2.c | 2 | ||||
-rw-r--r-- | gcc/tree-vect-slp.cc | 37 |
7 files changed, 33 insertions, 21 deletions
diff --git a/gcc/testsuite/g++.dg/vect/slp-pr87105.cc b/gcc/testsuite/g++.dg/vect/slp-pr87105.cc index d07b1cd..1701768 100644 --- a/gcc/testsuite/g++.dg/vect/slp-pr87105.cc +++ b/gcc/testsuite/g++.dg/vect/slp-pr87105.cc @@ -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 } } } } } diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-17.c b/gcc/testsuite/gcc.dg/vect/bb-slp-17.c index fc3ef42..e7bb06b 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-17.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-17.c @@ -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 } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-20.c b/gcc/testsuite/gcc.dg/vect/bb-slp-20.c index 134858c..7b25f91 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-20.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-20.c @@ -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 } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-21.c b/gcc/testsuite/gcc.dg/vect/bb-slp-21.c index d4c98d6..45054cd 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-21.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-21.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-22.c b/gcc/testsuite/gcc.dg/vect/bb-slp-22.c index 92cc2a5..7bf7e2c 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-22.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-22.c @@ -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 } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-2.c b/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-2.c index 968cdf1..ead8d92 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-2.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-2.c @@ -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" } } */ diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index f029215..41997d5 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -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; } } |