aarch64: SVE: ICE in expand_direct_optab_fn [PR98177]
authorPrzemyslaw Wirkus <przemyslaw.wirkus@arm.com>
Fri, 18 Dec 2020 18:18:57 +0000 (18:18 +0000)
committerPrzemyslaw Wirkus <przemyslaw.wirkus@arm.com>
Fri, 18 Dec 2020 18:19:49 +0000 (18:19 +0000)
commitd44d47b49267b4265cee16d25b3f89dbf967cc0c
treed46cbc2aa30675bb8e449070a51008e01acb2c93
parent60cecb2b83ffcebac6e83076f5552df14b073248
aarch64: SVE: ICE in expand_direct_optab_fn [PR98177]

Problem comes from using the wrong interface to get the index type for a
COND_REDUCTION. For fixed-length SVE we get a V2SI (a 64-bit Advanced
SIMD vector) instead of a VNx2SI (an SVE vector that stores SI elements
in DI containers).

Credits to Richard Sandiford for pointing out the issue's root cause.

Original PR snippet proposed to reproduce issue was only causing ICE for C++
compiler (see pr98177-1 test cases). I've slightly modified original
snippet in order to reproduce issue on both C and C++ compilers. These
are pr98177-2 test cases.

gcc/ChangeLog:

PR target/98177
* tree-vect-loop.c (vect_create_epilog_for_reduction): Use
get_same_sized_vectype to obtain index type.
(vectorizable_reduction): Likewise.

gcc/testsuite/ChangeLog:

PR target/98177
* g++.target/aarch64/sve/pr98177-1.C: New test.
* g++.target/aarch64/sve/pr98177-2.C: New test.
* gcc.target/aarch64/sve/pr98177-1.c: New test.
* gcc.target/aarch64/sve/pr98177-2.c: New test.
gcc/testsuite/g++.target/aarch64/sve/pr98177-1.C [new file with mode: 0644]
gcc/testsuite/g++.target/aarch64/sve/pr98177-2.C [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/pr98177-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/pr98177-2.c [new file with mode: 0644]
gcc/tree-vect-loop.c