Clang crash on aarch64: error in backend: Don't know how to widen the operands for INSERT_SUBVECTOR
The testcase
long long a;
short b;
long c;
long d(long e) {
if (e < c)
return c;
return e;
}
void f(short e[][12], long long g[][2][2]) {
for (int h;;)
for (int i; i < 10; i += e[-1][4])
#pragma clang loop vectorize_predicate(enable)
for (char j; j < 012; j += 4) {
b = g[1][h][j];
a = d(a);
}
}
crashes with -O3 -march=armv9-a error in backend: Don't know how to widen the operands for INSERT_SUBVECTOR
@llvm/issue-subscribers-backend-aarch64
Author: Kyrill Tkachov (ktkachov)
When I try this on a build with assertions enabled, I get: Assertion 'VF.Width == BestVF && "VPlan cost model and legacy cost model disagreed"' failed.
It seems the LV has picked a VF=vscale x 1 which is not yet supported by AArch64 type legalisation, but the CostModel should have prevented this VF from being picked in the first place. Normally the cost-model returns an invalid cost for memory operations with this VF which would prevent using this VF, but I can't see the (VPlan?) cost-model querying the cost of the load/store operations in this loop.
It looks like this would be fixed by #102105, but @sdesmalen-arm comment suggests there might be other case (which have only loads / stores, or other stuff that isn't handled by that patch), where it could still pick an invalid factor.
Please reopen if still not fixed.