summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-23 18:56:07 +0000
committerChris Lattner <sabre@nondot.org>2010-01-23 18:56:07 +0000
commitde5ab4860fcc53d91b3d8663c1c080d9031e291c (patch)
treea7a66fb1d47a397bb56e0c62a25945a524588970 /llvm/lib/Transforms
parent249da5cb73cb9e55d2edfe831fc2cf33402b76d7 (diff)
downloadbcm5719-llvm-de5ab4860fcc53d91b3d8663c1c080d9031e291c.tar.gz
bcm5719-llvm-de5ab4860fcc53d91b3d8663c1c080d9031e291c.zip
fix a crash in jump threading, PR6119
llvm-svn: 94319
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/JumpThreading.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index 95313115518..3a65c98195e 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -451,6 +451,12 @@ static unsigned GetBestDestForJumpOnUndef(BasicBlock *BB) {
/// ProcessBlock - If there are any predecessors whose control can be threaded
/// through to a successor, transform them now.
bool JumpThreading::ProcessBlock(BasicBlock *BB) {
+ // If the block is trivially dead, just return and let the caller nuke it.
+ // This simplifies other transformations.
+ if (pred_begin(BB) == pred_end(BB) &&
+ BB != &BB->getParent()->getEntryBlock())
+ return false;
+
// If this block has a single predecessor, and if that pred has a single
// successor, merge the blocks. This encourages recursive jump threading
// because now the condition in this block can be threaded through
OpenPOWER on IntegriCloud