[PATCH] D118472: [LoopPeel] Check for non-LCSSA form loops
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 31 01:15:17 PST 2022
mkazantsev requested changes to this revision.
mkazantsev added a comment.
This revision now requires changes to proceed.
This patch does not account for the fact that `DT` and `LI` can both be `nullptr`. I think it may be reasonable to lift this restriction, but so far the pass supports this case. If you can't go w/o `DT` and `LI`, then we first need to rework the pass in a way that it always expects `DT` and `LI`.
================
Comment at: llvm/lib/Transforms/Scalar/LoopFuse.cpp:195
+ GuardBranch(L->getLoopGuardBranch()), PP(PP),
+ AbleToPeel(canPeel(L, *(const_cast<DominatorTree *>(DT)), *LI)),
+ Peeled(false), DT(DT), PDT(PDT), LI(LI), ORE(ORE) {
----------------
Loop peeling pass is not guaranteed to be provided with `DT` and `LI`. They can both be (and sometimes are) nullptr, at least in old PM.
================
Comment at: llvm/lib/Transforms/Utils/LoopPeel.cpp:748
assert(PeelCount > 0 && "Attempt to peel out zero iterations?");
- assert(canPeel(L) && "Attempt to peel a loop which is not peelable?");
+ assert(canPeel(L, *DT, *LI) && "Attempt to peel a loop which is not peelable?");
----------------
This should also work for `DT == nullptr`, see checks below (line 764).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118472/new/
https://reviews.llvm.org/D118472
More information about the llvm-commits
mailing list