aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr98308.c16
-rw-r--r--gcc/tree-vect-stmts.c11
2 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/pr98308.c b/gcc/testsuite/gcc.dg/vect/pr98308.c
new file mode 100644
index 0000000..7d717b1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr98308.c
@@ -0,0 +1,16 @@
+/* { 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;
+ }
+}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 9e94675..54fb68b 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -8563,6 +8563,17 @@ vectorizable_load (vec_info *vinfo,
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;