Commit 1930524
authored
[LoopVectorize] Fix cost model assert when vectorising calls (#125716)
The legacy and vplan cost models did not agree because
VPWidenCallRecipe::computeCost only calculates the cost of the
call instruction, whereas
LoopVectorizationCostModel::setVectorizedCallDecision in some
cases adds on the cost of a synthesised mask argument. However,
this mask is always 'splat(i1 true)' which should be hoisted out
of the loop during codegen. In order to synchronise the two cost
models I have two options:
1) Also add the cost of the splat to the vplan model, or
2) Remove the cost of the splat from the legacy model.
I chose 2) because I feel this more closely represents what the
final code will look like. There is an argument that we should
take account of such broadcast costs in the preheader when
deciding if it's profitable to vectorise a loop, however there
isn't currently a mechanism to do this. We currently only take
account of the runtime checks when assessing profitability and
what the minimum trip count should be. However, I don't believe
this work needs doing as part of this PR.1 parent 7aeae73 commit 1930524
File tree
2 files changed
+262
-23
lines changed- llvm
- lib/Transforms/Vectorize
- test/Transforms/LoopVectorize/AArch64
2 files changed
+262
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6354 | 6354 | | |
6355 | 6355 | | |
6356 | 6356 | | |
6357 | | - | |
6358 | | - | |
6359 | | - | |
6360 | | - | |
6361 | | - | |
6362 | | - | |
6363 | | - | |
6364 | | - | |
6365 | | - | |
6366 | | - | |
6367 | 6357 | | |
6368 | | - | |
6369 | | - | |
| 6358 | + | |
6370 | 6359 | | |
6371 | 6360 | | |
6372 | 6361 | | |
| |||
0 commit comments