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 | 29b15c5cfdbbbc9bba895ab17b86fea5bda41fad (patch) | |
| tree | 5b2f3fe829f87bd7ddf22207689d3949aaa9c5ee /llvm/lib/Transforms | |
| parent | 32966aed9dc8f3cf3df3b337d5b52d7b48b40731 (diff) | |
| download | bcm5719-llvm-29b15c5cfdbbbc9bba895ab17b86fea5bda41fad.tar.gz bcm5719-llvm-29b15c5cfdbbbc9bba895ab17b86fea5bda41fad.zip | |
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.
llvm-svn: 94323
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/JumpThreading.cpp | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index a7b4d157fcd..3eff3d8d23d 100644 --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/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());    } | 

