aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopPeel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopPeel.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopPeel.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopPeel.cpp b/llvm/lib/Transforms/Utils/LoopPeel.cpp
index b2fe564..d6bdc1b 100644
--- a/llvm/lib/Transforms/Utils/LoopPeel.cpp
+++ b/llvm/lib/Transforms/Utils/LoopPeel.cpp
@@ -103,15 +103,15 @@ bool llvm::canPeel(Loop *L) {
SmallVector<BasicBlock *, 4> Exits;
L->getUniqueNonLatchExitBlocks(Exits);
// The latch must either be the only exiting block or all non-latch exit
- // blocks have either a deopt or unreachable terminator. Both deopt and
- // unreachable terminators are a strong indication they are not taken. Note
- // that this is a profitability check, not a legality check. Also note that
- // LoopPeeling currently can only update the branch weights of latch blocks
- // and branch weights to blocks with deopt or unreachable do not need
+ // blocks have either a deopt or unreachable terminator or compose a chain of
+ // blocks where the last one is either deopt or unreachable terminated. Both
+ // deopt and unreachable terminators are a strong indication they are not
+ // taken. Note that this is a profitability check, not a legality check. Also
+ // note that LoopPeeling currently can only update the branch weights of latch
+ // blocks and branch weights to blocks with deopt or unreachable do not need
// updating.
return all_of(Exits, [](const BasicBlock *BB) {
- return BB->getTerminatingDeoptimizeCall() ||
- isa<UnreachableInst>(BB->getTerminator());
+ return IsBlockFollowedByDeoptOrUnreachable(BB);
});
}