Commit 8cda227
committed
[LV] Fix crash when computing max VF too early
D90687 introduced a crash:
llvm::LoopVectorizationCostModel::computeMaxVF(llvm::ElementCount, unsigned int):
Assertion `WideningDecisions.empty() && Uniforms.empty() && Scalars.empty() &&
"No decisions should have been taken at this point"' failed.
when compiling the following C code:
typedef struct {
char a;
} b;
b *c;
int d, e;
int f() {
int g = 0;
for (; d; d++) {
e = 0;
for (; e < c[d].a; e++)
g++;
}
return g;
}
with:
clang -Os -target hexagon -mhvx -fvectorize -mv67 testcase.c -S -o -
This occurred since prior to D90687 computeFeasibleMaxVF would only be
called in computeMaxVF when a scalar epilogue was allowed, but now it's
always called. This causes the assert above since computeFeasibleMaxVF
collects all viable VFs larger than the default MaxVF, and for each VF
calculates the register usage which results in analysis being done the
assert above guards against. This can occur in computeFeasibleMaxVF if
TTI.shouldMaximizeVectorBandwidth and this target hook is implemented in
the hexagon backend to always return true.
Reported by @iajbar.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D948691 parent 3b8a1d5 commit 8cda227
File tree
2 files changed
+32
-4
lines changed- llvm
- lib/Transforms/Vectorize
- test/Transforms/LoopVectorize/Hexagon
2 files changed
+32
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5505 | 5505 | | |
5506 | 5506 | | |
5507 | 5507 | | |
5508 | | - | |
5509 | | - | |
5510 | 5508 | | |
5511 | 5509 | | |
5512 | | - | |
| 5510 | + | |
5513 | 5511 | | |
5514 | 5512 | | |
5515 | 5513 | | |
| |||
5547 | 5545 | | |
5548 | 5546 | | |
5549 | 5547 | | |
5550 | | - | |
| 5548 | + | |
5551 | 5549 | | |
5552 | 5550 | | |
5553 | 5551 | | |
| |||
5564 | 5562 | | |
5565 | 5563 | | |
5566 | 5564 | | |
| 5565 | + | |
5567 | 5566 | | |
5568 | 5567 | | |
5569 | 5568 | | |
| |||
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments