summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/JumpThreading.cpp
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
commit8231fd1e6ca940511843381ea5f0dbfbc740b1e6 (patch)
tree8a8167a77c8a4ce3a111c6995ec940ecee541381 /lib/Transforms/Scalar/JumpThreading.cpp
parent818ff34bc0841edda10951b7b043076b6e7159ef (diff)
downloadllvm-8231fd1e6ca940511843381ea5f0dbfbc740b1e6.tar.gz
llvm-8231fd1e6ca940511843381ea5f0dbfbc740b1e6.tar.bz2
llvm-8231fd1e6ca940511843381ea5f0dbfbc740b1e6.tar.xz
fix a crash in jump threading, PR6119
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r--lib/Transforms/Scalar/JumpThreading.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp
index 9531311551..3a65c98195 100644
--- a/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/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