diff options
author | Chris Lattner <sabre@nondot.org> | 2007-04-17 17:47:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-04-17 17:47:54 +0000 |
commit | decb0ca18b0fc7ea071b67b005f639fd4c4404d9 (patch) | |
tree | c34daf2772d8c0bb5fa5a4e558d326640c6bb7ce /lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | b8e237bb86cf810deba0bd0d11c12312978667be (diff) |
remove use of Instruction::getNext
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36199 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 4ee51039ce..f4dc8a9840 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1447,10 +1447,11 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { // predecessor and use logical operations to pick the right destination. BasicBlock *TrueDest = BI->getSuccessor(0); BasicBlock *FalseDest = BI->getSuccessor(1); - if (Instruction *Cond = dyn_cast<Instruction>(BI->getCondition())) + if (Instruction *Cond = dyn_cast<Instruction>(BI->getCondition())) { + BasicBlock::iterator CondIt = Cond; if ((isa<CmpInst>(Cond) || isa<BinaryOperator>(Cond)) && Cond->getParent() == BB && &BB->front() == Cond && - Cond->getNext() == BI && Cond->hasOneUse() && + &*++CondIt == BI && Cond->hasOneUse() && TrueDest != BB && FalseDest != BB) for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI!=E; ++PI) if (BranchInst *PBI = dyn_cast<BranchInst>((*PI)->getTerminator())) @@ -1496,8 +1497,9 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { return SimplifyCFG(BB) | 1; } } + } - // Scan predessor blocks for conditional branchs. + // Scan predessor blocks for conditional branches. for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) if (BranchInst *PBI = dyn_cast<BranchInst>((*PI)->getTerminator())) if (PBI != BI && PBI->isConditional()) { |