The following avoids ICEing with a reduction only consisting of
noop-conversions.
PR tree-optimization/123221
* tree-vect-loop.cc (vectorizable_reduction): When we did not
find the non-conversion reduction operation, bail.
* gcc.dg/vect/vect-pr123221.c: New testcase.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-pre" } */
+
+int a, d;
+struct {
+ char b;
+} c;
+int main()
+{
+ int f;
+ for (; d; d++)
+ c.b = f = a ? c.b : 0;
+ return 0;
+}
}
reduc_chain_length++;
}
+ if (!slp_for_stmt_info)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "only noop-conversions in the reduction chain.\n");
+ return false;
+ }
stmt_info = SLP_TREE_REPRESENTATIVE (slp_for_stmt_info);
/* PHIs should not participate in patterns. */