aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-10-28 13:21:53 +0100
committerRichard Biener <rguenther@suse.de>2020-10-28 15:04:06 +0100
commitb626b00823af9ca9ab619fe13d1e8703a3101dab (patch)
tree253092dae04e57d843f1dbe6856197d75c6947c9
parent616351b897c834500e685f4ab6ece4d82b506d29 (diff)
downloadgcc-b626b00823af9ca9ab619fe13d1e8703a3101dab.zip
gcc-b626b00823af9ca9ab619fe13d1e8703a3101dab.tar.gz
gcc-b626b00823af9ca9ab619fe13d1e8703a3101dab.tar.bz2
tree-optimization/97615 - avoid creating externals from patterns
The previous change missed to check for patterns again, the following corrects that. 2020-10-28 Richard Biener <rguenther@suse.de> PR tree-optimization/97615 * tree-vect-slp.c (vect_build_slp_tree_2): Do not build an external from pattern defs. * gcc.dg/vect/bb-slp-pr97615.c: New testcase.
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97615.c23
-rw-r--r--gcc/tree-vect-slp.c3
2 files changed, 25 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97615.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97615.c
new file mode 100644
index 0000000..b4a8aa2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97615.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+short *a;
+int e, f;
+
+void
+foo (int c, int d)
+{
+ short *a1, *a2, *a3;
+ a1 = a++;
+ *a1 = c;
+ a2 = a++;
+ *a2 = *a1;
+ a3 = a++;
+ *a3 = d;
+}
+
+void
+bar (void)
+{
+ foo (e + f - 2, e + f - 1);
+ foo (e + f - 1, 0);
+}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 5eafc03..9f1da30 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1599,7 +1599,8 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
}
if (is_a <bb_vec_info> (vinfo)
- && oprnd_info->first_dt == vect_internal_def)
+ && oprnd_info->first_dt == vect_internal_def
+ && !oprnd_info->any_pattern)
{
/* For BB vectorization, if all defs are the same do not
bother to continue the build along the single-lane