summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-12-10 17:42:31 +0000
committerChris Lattner <sabre@nondot.org>2004-12-10 17:42:31 +0000
commit4fc998da2edc74a9c94189785b3ba67623ed167a (patch)
treefe1206da400891ef106211b23ca758dcefc9b94d /llvm/lib/Transforms
parent88bd77c73d110cf67ffaacebd0e5ef7c3fe23e4c (diff)
downloadbcm5719-llvm-4fc998da2edc74a9c94189785b3ba67623ed167a.tar.gz
bcm5719-llvm-4fc998da2edc74a9c94189785b3ba67623ed167a.zip
Fix Regression/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll,
and the failure on make_dparser last night. llvm-svn: 18766
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 4b7071d4e18..bbeb28d9772 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1164,21 +1164,20 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
// is a conditional branch, see if we can hoist any code from this block up
// into our predecessor.
if (OnlyPred)
- if (BranchInst *BI = dyn_cast<BranchInst>(OnlyPred->getTerminator())) {
- // This is guaranteed to be a condbr at this point.
- assert(BI->isConditional() && "Should have folded bb into pred!");
- // Get the other block.
- BasicBlock *OtherBB = BI->getSuccessor(BI->getSuccessor(0) == BB);
- PI = pred_begin(OtherBB);
- ++PI;
- if (PI == pred_end(OtherBB)) {
- // We have a conditional branch to two blocks that are only reachable
- // from the condbr. We know that the condbr dominates the two blocks,
- // so see if there is any identical code in the "then" and "else"
- // blocks. If so, we can hoist it up to the branching block.
- Changed |= HoistThenElseCodeToIf(BI);
+ if (BranchInst *BI = dyn_cast<BranchInst>(OnlyPred->getTerminator()))
+ if (BI->isConditional()) {
+ // Get the other block.
+ BasicBlock *OtherBB = BI->getSuccessor(BI->getSuccessor(0) == BB);
+ PI = pred_begin(OtherBB);
+ ++PI;
+ if (PI == pred_end(OtherBB)) {
+ // We have a conditional branch to two blocks that are only reachable
+ // from the condbr. We know that the condbr dominates the two blocks,
+ // so see if there is any identical code in the "then" and "else"
+ // blocks. If so, we can hoist it up to the branching block.
+ Changed |= HoistThenElseCodeToIf(BI);
+ }
}
- }
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI)
if (BranchInst *BI = dyn_cast<BranchInst>((*PI)->getTerminator()))
OpenPOWER on IntegriCloud