Because the vect_recog_bool_pattern can at the moment still transition
out of GIMPLE and back into GENERIC the vect_recog_cond_store_pattern can
end up using an expression as a mask rather than an SSA_NAME.
This adds an explicit check that we have a mask and not an expression.
gcc/ChangeLog:
PR tree-optimization/116628
* tree-vect-patterns.cc (vect_recog_cond_store_pattern): Add SSA_NAME
check on expression.
gcc/testsuite/ChangeLog:
PR tree-optimization/116628
* gcc.dg/vect/pr116628.c: New test.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_float } */
+/* { dg-require-effective-target vect_masked_store } */
+/* { dg-additional-options "-Ofast -march=armv9-a" { target aarch64-*-* } } */
+
+typedef float c;
+c a[2000], b[0];
+void d() {
+ for (int e = 0; e < 2000; e++)
+ if (b[e])
+ a[e] = b[e];
+}
+
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
/* Check if the else value matches the original loaded one. */
bool invert = false;
tree cmp_ls = gimple_arg (cond_stmt, 0);
+ if (TREE_CODE (cmp_ls) != SSA_NAME)
+ return NULL;
+
tree cond_arg1 = gimple_arg (cond_stmt, 1);
tree cond_arg2 = gimple_arg (cond_stmt, 2);