From: Richard Sandiford Date: Tue, 17 Nov 2020 11:51:40 +0000 (+0000) Subject: PR97693: Specify required vectype in vectorizable_call X-Git-Tag: basepoints/gcc-12~3169 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcd513df9aa83f30dbd1c34d13c8a0972702ffa1;p=thirdparty%2Fgcc.git PR97693: Specify required vectype in vectorizable_call 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. --- diff --git a/gcc/testsuite/gcc.dg/vect/pr97693.c b/gcc/testsuite/gcc.dg/vect/pr97693.c new file mode 100644 index 000000000000..4da44c705553 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr97693.c @@ -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; +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 2c7a8a70913b..4e535fec9ca5 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -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]; }