summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit8a172daa55c261eb378697d98eb2c0d8a2af4b9c (patch)
tree11974bd8bafdd04f7ae083bcdf7daa6360611609 /llvm/lib/Transforms/Scalar/JumpThreading.cpp
parent71ecd67b5d87207fca79d120dbf1feae157ddc47 (diff)
downloadbcm5719-llvm-8a172daa55c261eb378697d98eb2c0d8a2af4b9c.tar.gz
bcm5719-llvm-8a172daa55c261eb378697d98eb2c0d8a2af4b9c.zip
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. llvm-svn: 60210
Diffstat (limited to 'llvm/lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/JumpThreading.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index 5de5fb3b776..114603dabb0 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud