aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/JumpThreading.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-28 19:54:49 +0000
committerChris Lattner <sabre@nondot.org>2008-11-28 19:54:49 +0000
commitf5102a0f088e7c96f7028bf7ca1c24975c314fff (patch)
tree112c00bfeacfd18dbf355f8fc8c56664f43f11e7 /lib/Transforms/Scalar/JumpThreading.cpp
parentc6dbe7fbad79eddb030a4450a135d13e6b0ca942 (diff)
don't call MergeBasicBlockIntoOnlyPred on a block whose only
predecessor is itself. This doesn't make sense, and this is a dead infinite loop anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60210 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r--lib/Transforms/Scalar/JumpThreading.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp
index 5de5fb3b77..114603dabb 100644
--- a/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/lib/Transforms/Scalar/JumpThreading.cpp
@@ -164,7 +164,8 @@ bool JumpThreading::ProcessBlock(BasicBlock *BB) {
// because now the condition in this block can be threaded through
// predecessors of our predecessor block.
if (BasicBlock *SinglePred = BB->getSinglePredecessor())
- if (SinglePred->getTerminator()->getNumSuccessors() == 1) {
+ if (SinglePred->getTerminator()->getNumSuccessors() == 1 &&
+ SinglePred != BB) {
// Remember if SinglePred was the entry block of the function. If so, we
// will need to move BB back to the entry position.
bool isEntry = SinglePred == &SinglePred->getParent()->getEntryBlock();