diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-23 18:56:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-23 18:56:07 +0000 |
commit | 8231fd1e6ca940511843381ea5f0dbfbc740b1e6 (patch) | |
tree | 8a8167a77c8a4ce3a111c6995ec940ecee541381 /lib/Transforms/Scalar | |
parent | 818ff34bc0841edda10951b7b043076b6e7159ef (diff) | |
download | external_llvm-8231fd1e6ca940511843381ea5f0dbfbc740b1e6.zip external_llvm-8231fd1e6ca940511843381ea5f0dbfbc740b1e6.tar.gz external_llvm-8231fd1e6ca940511843381ea5f0dbfbc740b1e6.tar.bz2 |
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')
-rw-r--r-- | lib/Transforms/Scalar/JumpThreading.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp index 9531311..3a65c98 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 |