diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-23 19:21:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-23 19:21:31 +0000 |
commit | d668839cb9b5db6865fd98e5e7dfccd64abf3e95 (patch) | |
tree | a2155e800ad98220ab369474ee87cb5d4f237429 /lib/Transforms/Scalar | |
parent | dbeecede809c1bffb016e48674622c5e8cb75a0c (diff) | |
download | external_llvm-d668839cb9b5db6865fd98e5e7dfccd64abf3e95.zip external_llvm-d668839cb9b5db6865fd98e5e7dfccd64abf3e95.tar.gz external_llvm-d668839cb9b5db6865fd98e5e7dfccd64abf3e95.tar.bz2 |
third bug from PR6119: the xor dupe extension allows
for arbitrary terminators in predecessors, don't assume
it is a conditional or uncond branch. The testcase shows
an example where they can happen with switches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94323 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r-- | lib/Transforms/Scalar/JumpThreading.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp index a7b4d15..3eff3d8 100644 --- a/lib/Transforms/Scalar/JumpThreading.cpp +++ b/lib/Transforms/Scalar/JumpThreading.cpp @@ -1424,9 +1424,9 @@ bool JumpThreading::DuplicateCondBranchOnPHIIntoPred(BasicBlock *BB, // Unless PredBB ends with an unconditional branch, split the edge so that we // can just clone the bits from BB into the end of the new PredBB. - BranchInst *OldPredBranch = cast<BranchInst>(PredBB->getTerminator()); + BranchInst *OldPredBranch = dyn_cast<BranchInst>(PredBB->getTerminator()); - if (!OldPredBranch->isUnconditional()) { + if (OldPredBranch == 0 || !OldPredBranch->isUnconditional()) { PredBB = SplitEdge(PredBB, BB, this); OldPredBranch = cast<BranchInst>(PredBB->getTerminator()); } |