[llvm] [LV][NFC] Clean up tail-folding check for early-exit loops (PR #133931)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 7 07:12:51 PDT 2025
================
@@ -4032,14 +4016,17 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) {
}
auto NoScalarEpilogueNeeded = [this, &UserIC](unsigned MaxVF) {
+ if (TheLoop->getExitingBlock() != TheLoop->getLoopLatch() &&
+ !Legal->hasUncountableEarlyExit())
+ return false;
unsigned MaxVFtimesIC = UserIC ? MaxVF * UserIC : MaxVF;
ScalarEvolution *SE = PSE.getSE();
- // Currently only loops with countable exits are vectorized, but calling
- // getSymbolicMaxBackedgeTakenCount allows enablement work for loops with
- // uncountable exits whilst also ensuring the symbolic maximum and known
- // back-edge taken count remain identical for loops with countable exits.
+ // Calling getSymbolicMaxBackedgeTakenCount enables support for loops
+ // with uncountable exits. For countable loops, the symbolic maximum must
+ // remain identical to the known back-edge taken count.
const SCEV *BackedgeTakenCount = PSE.getSymbolicMaxBackedgeTakenCount();
- assert(BackedgeTakenCount == PSE.getBackedgeTakenCount() &&
+ assert((Legal->hasUncountableEarlyExit() ||
+ BackedgeTakenCount == PSE.getBackedgeTakenCount()) &&
----------------
fhahn wrote:
Are those changes still needed?
https://github.com/llvm/llvm-project/pull/133931
More information about the llvm-commits
mailing list