The following makes sure to register a loop mask if we mask the loop
because the call could trap.
PR tree-optimization/123755
* tree-vect-stmts.cc (vectorizable_call): Register mask when
the call could trap.
* gcc.dg/vect/vect-pr123755.c: New testcase.
--- /dev/null
+/* { dg-do compile } */
+
+float a[4], b[4];
+
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 4; ++i)
+ b[i] = __builtin_fma (1024.0f, 1024.0f, a[i]);
+ return 0;
+}
if (loop_vinfo
&& LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo)
- && (reduc_idx >= 0 || mask_opno >= 0))
+ && (reduc_idx >= 0 || could_trap || mask_opno >= 0))
{
if (reduc_idx >= 0
&& (cond_fn == IFN_LAST