[llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Chris Lattner
sabre at nondot.org
Tue Apr 17 10:48:14 PDT 2007
Changes in directory llvm/lib/Transforms/Utils:
SimplifyCFG.cpp updated: 1.120 -> 1.121
---
Log message:
remove use of Instruction::getNext
---
Diffs of the changes: (+5 -3)
SimplifyCFG.cpp | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.120 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.121
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.120 Sun Apr 1 20:44:59 2007
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Tue Apr 17 12:47:54 2007
@@ -1447,10 +1447,11 @@
// 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 @@
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()) {
More information about the llvm-commits
mailing list