diff options
Diffstat (limited to 'lib')
-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 a7b4d157fc..3eff3d8d23 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()); } |