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.
--- /dev/null
+/* { 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);
+}
}
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