summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/GuardWidening.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/GuardWidening.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/GuardWidening.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/GuardWidening.cpp b/llvm/lib/Transforms/Scalar/GuardWidening.cpp
index cb0ee7b741a..e7da37ebf8c 100644
--- a/llvm/lib/Transforms/Scalar/GuardWidening.cpp
+++ b/llvm/lib/Transforms/Scalar/GuardWidening.cpp
@@ -380,7 +380,8 @@ bool GuardWideningImpl::eliminateGuardViaWidening(
assert((i == (e - 1)) == (GuardInst->getParent() == CurBB) && "Bad DFS?");
- if (i == (e - 1) && CurBB->getTerminator() != GuardInst) {
+ if (GuardInst->getParent() == CurBB &&
+ CurBB->getTerminator() != GuardInst) {
// Corner case: make sure we're only looking at guards strictly dominating
// GuardInst when visiting GuardInst->getParent().
auto NewEnd = std::find(I, E, GuardInst);
OpenPOWER on IntegriCloud