summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/JumpThreading.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-10 21:45:09 +0000
committerChris Lattner <sabre@nondot.org>2009-11-10 21:45:09 +0000
commit6f84a5feee5c7322a5145992bd4704225987909c (patch)
tree51ced6830d9e3fa25c5f8dffd3ea37e43ff65f67 /lib/Transforms/Scalar/JumpThreading.cpp
parentf3183f6da6321c6496daa107ea5d6d48b99d9330 (diff)
downloadllvm-6f84a5feee5c7322a5145992bd4704225987909c.tar.gz
llvm-6f84a5feee5c7322a5145992bd4704225987909c.tar.bz2
llvm-6f84a5feee5c7322a5145992bd4704225987909c.tar.xz
improve comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86723 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r--lib/Transforms/Scalar/JumpThreading.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp
index 1d89399e74..2d8309d520 100644
--- a/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/lib/Transforms/Scalar/JumpThreading.cpp
@@ -142,11 +142,14 @@ bool JumpThreading::runOnFunction(Function &F) {
++BBI;
// If the terminator is the only non-phi instruction, try to nuke it.
if (BBI->isTerminator()) {
- bool Erased = LoopHeaders.erase(BB);
+ // Since TryToSimplifyUncondBranchFromEmptyBlock may delete the
+ // block, we have to make sure it isn't in the LoopHeaders set. We
+ // reinsert afterward in the rare case when the block isn't deleted.
+ bool ErasedFromLoopHeaders = LoopHeaders.erase(BB);
if (TryToSimplifyUncondBranchFromEmptyBlock(BB))
Changed = true;
- else if (Erased)
+ else if (ErasedFromLoopHeaders)
LoopHeaders.insert(BB);
}
}