This makes sure to set the vector type on an invariant mask argument
for a masked load and SLP.
2021-01-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/98308
* tree-vect-stmts.c (vectorizable_load): Set invariant mask
SLP vectype.
* gcc.dg/vect/pr98308.c: New testcase.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+/* { dg-additional-options "-march=skylake-avx512" { target avx512f } } */
+
+extern unsigned long long int arr_86[];
+extern unsigned long long int arr_87[][15];
+
+void test(_Bool a, unsigned short c[][15], unsigned char d[])
+{
+ for (short h = 0; h < 10; h++)
+ for (char i = 0; i < 15; i += 2)
+ {
+ arr_86[0] = d[0];
+ arr_87[h][0] = a ? c[h][i] : 0;
+ }
+}
if (!vec_stmt) /* transformation not required. */
{
+ if (slp_node
+ && mask
+ && !vect_maybe_update_slp_op_vectype (SLP_TREE_CHILDREN (slp_node)[0],
+ mask_vectype))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "incompatible vector types for invariants\n");
+ return false;
+ }
+
if (!slp)
STMT_VINFO_MEMORY_ACCESS_TYPE (stmt_info) = memory_access_type;