--- /dev/null
+/* PR target/99767 */
+/* { dg-do compile } */
+/* { dg-options " -O1 -fopenmp-simd -fno-tree-dce -march=armv8-a+sve" } */
+
+int a[1024], b[1024];
+
+void
+foo (void)
+{
+ #pragma omp simd
+ for (int i = 0; i < 1024; i++)
+ if (b[i] > 23) {
+ a[i] = b[i] + 1;
+ int v = 1 / 0; /* { dg-warning "division by zero" } */
+ }
+}
!gsi_end_p (gsi); gsi_next (&gsi))
{
gcall *call = dyn_cast <gcall *> (gsi_stmt (gsi));
- if (call && gimple_call_internal_p (call, IFN_MASK_LOAD))
+ if (!call || !gimple_call_internal_p (call))
+ continue;
+ internal_fn ifn = gimple_call_internal_fn (call);
+ if (ifn == IFN_MASK_LOAD)
{
tree lhs = gimple_get_lhs (call);
if (!VECTOR_TYPE_P (TREE_TYPE (lhs)))
gsi_replace (&gsi, new_stmt, true);
}
}
+ else if (conditional_internal_fn_code (ifn) != ERROR_MARK)
+ {
+ tree lhs = gimple_get_lhs (call);
+ if (!VECTOR_TYPE_P (TREE_TYPE (lhs)))
+ {
+ tree else_arg
+ = gimple_call_arg (call, gimple_call_num_args (call) - 1);
+ gimple *new_stmt = gimple_build_assign (lhs, else_arg);
+ gsi_replace (&gsi, new_stmt, true);
+ }
+ }
}
} /* BBs in loop */