[llvm] [LoopPeel] Remove known trip count restriction when peeling last. (PR #140792)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Sun May 25 15:05:14 PDT 2025
================
@@ -1080,11 +1086,40 @@ bool llvm::peelLoop(Loop *L, unsigned PeelCount, bool PeelLast, LoopInfo *LI,
for (PHINode &P : Exit->phis())
ExitValues[&P] = P.getIncomingValueForBlock(Latch);
+ const SCEV *BTC = SE->getBackedgeTakenCount(L);
+
InsertTop = SplitEdge(Latch, Exit, &DT, LI);
InsertBot = SplitBlock(InsertTop, InsertTop->getTerminator(), &DT, LI);
InsertTop->setName(Exit->getName() + ".peel.begin");
InsertBot->setName(Exit->getName() + ".peel.next");
+ NewPreHeader = nullptr;
+
+ // If the original loop may only execute a single iteration we need to
----------------
preames wrote:
Works, slightly verbose, but a lot more clear. Thanks.
https://github.com/llvm/llvm-project/pull/140792
More information about the llvm-commits
mailing list