This ICE is caused because of this situation:
mask__49.21_99 = vect__17.19_96 == { 0.0, ... };
...
vect__6.24_107 = .MASK_LEN_LOAD (vectp.22_105, 32B, mask__49.21_99, POLY_INT_CST [2, 2], 0);
The MASK_LEN_LOAD is using real MASK which is produced by the EQ comparison wheras the LEN
is the dummy LEN which is the vectorization factor.
In this situation, we didn't enter 'vect_record_loop_len' since there is no LEN loop control.
Then 'LOOP_VINFO_RGROUP_IV_TYPE' is not suitable type for 'build_int_cst' used for producing
LEN argument for 'MASK_LEN_LOAD', so use sizetype instead which is perfectly matching
RVV length requirement.
gcc/ChangeLog:
PR middle-end/110989
* tree-vect-stmts.cc (vectorizable_store): Replace iv_type with sizetype.
(vectorizable_load): Ditto.
gcc/testsuite/ChangeLog:
PR middle-end/110989
* gcc.target/riscv/rvv/autovec/pr110989.c: New test.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d --param=riscv-autovec-preference=scalable -Ofast" } */
+
+int a, b, c;
+double *d;
+void e() {
+ double f;
+ for (; c; c++, d--)
+ f = *d ?: *(&a + c);
+ b = f;
+}
if (!final_len)
{
/* Pass VF value to 'len' argument of
- MASK_LEN_STORE if LOOP_LENS is invalid. */
- tree iv_type = LOOP_VINFO_RGROUP_IV_TYPE (loop_vinfo);
- final_len
- = build_int_cst (iv_type,
- TYPE_VECTOR_SUBPARTS (vectype));
+ MASK_LEN_STORE if LOOP_LENS is invalid. */
+ final_len = size_int (TYPE_VECTOR_SUBPARTS (vectype));
}
if (!final_mask)
{
{
/* Pass VF value to 'len' argument of
MASK_LEN_LOAD if LOOP_LENS is invalid. */
- tree iv_type
- = LOOP_VINFO_RGROUP_IV_TYPE (loop_vinfo);
final_len
- = build_int_cst (iv_type,
- TYPE_VECTOR_SUBPARTS (vectype));
+ = size_int (TYPE_VECTOR_SUBPARTS (vectype));
}
if (!final_mask)
{