[llvm] [LV] Pure runtime check for minimum profitable trip count. (PR #115833)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 13 06:29:46 PST 2024
================
@@ -2502,6 +2502,12 @@ void InnerLoopVectorizer::emitIterationCountCheck(BasicBlock *Bypass) {
#endif
// Don't execute the vector loop if (UMax - n) < (VF * UF).
CheckMinIters = Builder.CreateICmp(ICmpInst::ICMP_ULT, LHS, Step);
+ } else if (MinProfitableTripCount.isNonZero()) {
----------------
david-arm wrote:
Actually I can see in `areRuntimeChecksProfitable` there is something about tail-folding near the end:
```
// Now pick the larger minimum. If it is not a multiple of VF and a scalar
// epilogue is allowed, choose the next closest multiple of VF. This should
// partly compensate for ignoring the epilogue cost.
uint64_t MinTC = std::max(MinTC1, MinTC2);
if (SEL == CM_ScalarEpilogueAllowed)
MinTC = alignTo(MinTC, IntVF);
VF.MinProfitableTripCount = ElementCount::getFixed(MinTC);
```
so at least the min trip count isn't being rounded up
https://github.com/llvm/llvm-project/pull/115833
More information about the llvm-commits
mailing list