This shows reassoc is harmful even with len == 3.
PR tree-optimization/120687
* gcc.dg/vect/pr120687-3.c: New testcase.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+/* { dg-additional-options "-ffast-math" } */
+
+float
+frd (float *p, float *lastone)
+{
+ float sum = 0;
+ for (; p <= lastone; p += 2)
+ sum += p[0] + p[1];
+ return sum;
+}
+
+/* { dg-final { scan-tree-dump "reduction: detected reduction chain" "vect" } } */
+/* { dg-final { scan-tree-dump-not "SLP discovery of reduction chain failed" "vect" } } */
+/* { dg-final { scan-tree-dump "optimized: loop vectorized" "vect" } } */