Loop peeling assumes that the loop's latch is a conditional branch. Add
a check to canPeel that explicitly checks for this, and a testcase that
otherwise fails an assertion when trying to peel a loop whose back-edge
is the non-unwind edge of an invoke.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
This is meant to address a regression from rG7f69860243e8, which moved a check for whether dynamic cast to BranchInst succeeds in UnrollLoop from before to after the call to peelLoop. Adding a check to canPeel seemed like the most logical option to me.
llvm/lib/Transforms/Utils/LoopPeel.cpp | ||
---|---|---|
664 | Sorry, I jumped the gun in posting this -- this change makes the assertion here fail in several of the loop peeling lit tests. I'm taking a look... |
llvm/lib/Transforms/Utils/LoopPeel.cpp | ||
---|---|---|
664 |
Fixed. |
llvm/lib/Transforms/Utils/LoopPeel.cpp | ||
---|---|---|
123 | this does only check for branch instructions, not conditional branches. Can you update the comment? |
Looks like this issue has also been reported in https://bugs.llvm.org/show_bug.cgi?id=48812
llvm/lib/Transforms/Utils/LoopPeel.cpp | ||
---|---|---|
123 |
Updated. |
this does only check for branch instructions, not conditional branches. Can you update the comment?