aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2025-07-10 13:04:00 +0200
committerRichard Biener <rguenther@suse.de>2025-07-17 08:26:40 +0200
commit246ecf81612518196f4aa45fe96f85831fe408ff (patch)
treec3bf53ee130970e808eb4edb536b670e335bb3f6 /gcc
parent9af57c471087a3a1b87621bce1208d6c77ba2a4a (diff)
downloadgcc-246ecf81612518196f4aa45fe96f85831fe408ff.zip
gcc-246ecf81612518196f4aa45fe96f85831fe408ff.tar.gz
gcc-246ecf81612518196f4aa45fe96f85831fe408ff.tar.bz2
Reject single lane vector types for SLP build
The following makes us never consider vector(1) T types for vectorization and ensures this during SLP build. This is a long-standing issue for BB vectorization and when we remove early loop vector type setting we lose the single place we have that rejects this for loops. Once we implement partial loop vectorization we should revisit this, but then use the original scalar types for the unvectorized parts. * tree-vect-slp.cc (vect_build_slp_tree_1): Reject single-lane vector types. * gcc.dg/vect/bb-slp-39.c: Adjust.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-39.c3
-rw-r--r--gcc/tree-vect-slp.cc10
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-39.c b/gcc/testsuite/gcc.dg/vect/bb-slp-39.c
index f05ce8f..255bb10 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-39.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-39.c
@@ -16,5 +16,4 @@ void foo (double *p)
}
/* See that we vectorize three SLP instances. */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "slp2" { target { ! { s390*-*-* riscv*-*-* } } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 5 "slp2" { target { s390*-*-* riscv*-*-* } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "slp2" } } */
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index ad753869..fe67d4d 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1114,6 +1114,16 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
matches[0] = false;
return false;
}
+ if (is_a <bb_vec_info> (vinfo)
+ && known_le (TYPE_VECTOR_SUBPARTS (vectype), 1U))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Build SLP failed: not using single lane "
+ "vector type %T\n", vectype);
+ matches[0] = false;
+ return false;
+ }
/* Record nunits required but continue analysis, producing matches[]
as if nunits was not an issue. This allows splitting of groups
to happen. */