[llvm] [LoopPeel] Use loop guards when checking if last iter can be peeled. (PR #142605)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 06:57:06 PDT 2025
================
@@ -374,6 +374,9 @@ static bool shouldPeelLastIteration(Loop &L, CmpPredicate Pred,
L.getLoopPredecessor()->getTerminator()))
return false;
+ auto Guards = ScalarEvolution::LoopGuards::collect(&L, SE);
+ BTC = SE.applyLoopGuards(BTC, Guards);
----------------
nikic wrote:
FWIW, I do think using loop guards for the isKnownNonZero(BTC) check makes sense, I was just saying it shouldn't be used for the high cost expansion check.
https://github.com/llvm/llvm-project/pull/142605
More information about the llvm-commits
mailing list