[llvm] [LoopPeel] Use loop guards when checking if last iter can be peeled. (PR #142605)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 00:29:27 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);
----------------
fhahn wrote:

Ah yes, makes sense. I'll adjust it separately, with a separate test case.

https://github.com/llvm/llvm-project/pull/142605


More information about the llvm-commits mailing list