If a candidate VF for epilogue vectorization is less than the number of
remaining iterations, the epilogue loop would be dead. Skip such factors.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | ||
|---|---|---|
| 5659 | nit (unrelated): avoid else after return. | |
| 5688–5692 | nit: can set Type *TCType = Legal->getWidestInductionType(); and use it below. | |
| 5701 | Worth early-continuing first if (a) !hasPlanWithVF, then if (b) NextVF >= EstimatedRuntimeVF, and last if (c) NextVF >= RemainingIterations? Note that for IC==1 and non scalable VF's, check (c) subsumes check (b). Can the checks below be simplified, given that EstimatedRuntimeVF = MainLoopVF if !MainLoopVF.isScalable()? | |
| llvm/test/Transforms/LoopVectorize/X86/gather_scatter.ll | ||
| 866 | nit: these UGLY-to-SCEV changes are unrelated. | |
| llvm/test/Transforms/LoopVectorize/X86/limit-vf-by-tripcount.ll | ||
| 7 | This patch addresses this TODO? | |
| llvm/test/Transforms/LoopVectorize/X86/pr42674.ll | ||
| 8 | Note that the change in generated code for this test appears to be indirectly related to fixing the VF selected for the epilog loop. | |
| llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | ||
|---|---|---|
| 5687 | While we're here, should EstimatedRuntimeVF (or rather, EstimatedMainLoopVF) be used for both scalable and non-scalable MainLoopVF below? | |
| 5704 | nit: reverse the condition to use ICMP_UGE as done above? | |
| llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | ||
|---|---|---|
| 5659 | Will adjust separately. | |
| 5687 |
In theory I think yes, all 4 combinations are possible I tried just checking EstimatedRuntimeVF and not MainVF but there are some SVE tests that are failing.
I added a TODO. I think for scalable vectors we would also need to estimate the runtime VFs and check those. | |
| 5688–5692 | Done, thanks! | |
| 5701 | Applied the first refactoring in b4efc0f070ba, update this patch, thanks! Will do the refactorings mentioned in the last paragraph separately. | |
| 5704 | updated, thanks! | |
This looks good to me, comment still needs to be fixed.
| llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | ||
|---|---|---|
| 5704 | nit: comment still needs to be fixed. | |
nit (unrelated): avoid else after return.