With bools we can have the usual mismatch between mask and data
use. Catch that, like we do elsewhere.
PR tree-optimization/121194
* tree-vect-loop.cc (vectorizable_lc_phi): Verify
vector types are compatible.
* gcc.dg/torture/pr121194.c: New testcase.
--- /dev/null
+/* { dg-do compile } */
+
+int a, b, c, d;
+void e() {
+ int *f = &b;
+ for (a = 0; a < 8; a++) {
+ *f = 0;
+ for (c = 0; c < 2; c++)
+ *f = *f == 0;
+ }
+}
+int main() {
+ e();
+ int *g = &b;
+ *g = *g == (d == 0);
+ return 0;
+}
"incompatible vector types for invariants\n");
return false;
}
+
+ /* ??? This can happen with data vs. mask uses of boolean. */
+ if (!useless_type_conversion_p (SLP_TREE_VECTYPE (slp_node),
+ SLP_TREE_VECTYPE
+ (SLP_TREE_CHILDREN (slp_node)[0])))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "missed mask promotion\n");
+ return false;
+ }
+
STMT_VINFO_TYPE (stmt_info) = lc_phi_info_type;
return true;
}