mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-17 18:24:34 +00:00
remove use of Instruction::getNext
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36199 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1447,10 +1447,11 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
|
|||||||
// predecessor and use logical operations to pick the right destination.
|
// predecessor and use logical operations to pick the right destination.
|
||||||
BasicBlock *TrueDest = BI->getSuccessor(0);
|
BasicBlock *TrueDest = BI->getSuccessor(0);
|
||||||
BasicBlock *FalseDest = BI->getSuccessor(1);
|
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)) &&
|
if ((isa<CmpInst>(Cond) || isa<BinaryOperator>(Cond)) &&
|
||||||
Cond->getParent() == BB && &BB->front() == Cond &&
|
Cond->getParent() == BB && &BB->front() == Cond &&
|
||||||
Cond->getNext() == BI && Cond->hasOneUse() &&
|
&*++CondIt == BI && Cond->hasOneUse() &&
|
||||||
TrueDest != BB && FalseDest != BB)
|
TrueDest != BB && FalseDest != BB)
|
||||||
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI!=E; ++PI)
|
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI!=E; ++PI)
|
||||||
if (BranchInst *PBI = dyn_cast<BranchInst>((*PI)->getTerminator()))
|
if (BranchInst *PBI = dyn_cast<BranchInst>((*PI)->getTerminator()))
|
||||||
@@ -1496,8 +1497,9 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
|
|||||||
return SimplifyCFG(BB) | 1;
|
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)
|
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI)
|
||||||
if (BranchInst *PBI = dyn_cast<BranchInst>((*PI)->getTerminator()))
|
if (BranchInst *PBI = dyn_cast<BranchInst>((*PI)->getTerminator()))
|
||||||
if (PBI != BI && PBI->isConditional()) {
|
if (PBI != BI && PBI->isConditional()) {
|
||||||
|
Reference in New Issue
Block a user