From fcd513df9aa83f30dbd1c34d13c8a0972702ffa1 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 17 Nov 2020 11:51:40 +0000 Subject: [PATCH] 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. --- gcc/testsuite/gcc.dg/vect/pr97693.c | 15 +++++++++++++++ gcc/tree-vect-stmts.c | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/vect/pr97693.c diff --git a/gcc/testsuite/gcc.dg/vect/pr97693.c b/gcc/testsuite/gcc.dg/vect/pr97693.c new file mode 100644 index 00000000000..4da44c70555 --- /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 2c7a8a70913..4e535fec9ca 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]; } -- 2.30.2