PR97693: Specify required vectype in vectorizable_call
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 17 Nov 2020 11:51:40 +0000 (11:51 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 17 Nov 2020 11:51:40 +0000 (11:51 +0000)
The vectorizable_call part of r11-1143 dropped the required
vectype when moving from vect_get_vec_def_for_operand to
vect_get_vec_defs_for_operand.  This caused an ICE on the
testcase for SVE, because we ended up with a non-predicate
value being passed to a predicate input.

AFAICT this was the only instance of that happening.  The types
seemed to get carried forward for all the other converted calls.

gcc/
PR tree-optimization/97693
* tree-vect-stmts.c (vectorizable_call): Pass the required vectype
to vect_get_vec_defs_for_operand.

gcc/testsuite/
PR tree-optimization/97693
* gcc.dg/vect/pr97693.c: New test.

gcc/testsuite/gcc.dg/vect/pr97693.c [new file with mode: 0644]
gcc/tree-vect-stmts.c

diff --git a/gcc/testsuite/gcc.dg/vect/pr97693.c b/gcc/testsuite/gcc.dg/vect/pr97693.c
new file mode 100644 (file)
index 0000000..4da44c7
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+extern short a[];
+int b;
+short c, d;
+unsigned e() {
+  if (c)
+    return c;
+  return d;
+}
+void f() {
+  for (unsigned g = b; g; g += 6)
+    for (_Bool h = 0; h < (_Bool)e(); h = 1)
+      a[g] = 1 / b;
+}
index 2c7a8a7..4e535fe 100644 (file)
@@ -3427,7 +3427,8 @@ vectorizable_call (vec_info *vinfo,
                {
                  vec_defs.quick_push (vNULL);
                  vect_get_vec_defs_for_operand (vinfo, stmt_info, ncopies,
-                                                op, &vec_defs[i]);
+                                                op, &vec_defs[i],
+                                                vectypes[i]);
                }
              orig_vargs[i] = vargs[i] = vec_defs[i][j];
            }