mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
make various clients of ReplaceAndSimplifyAllUses tolerate
it *changing* the things it replaces, not just causing them to drop to null. There is no functionality change yet, but this is required for a subsequent patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108414 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
75a5b71208
commit
35a939b97d
@ -306,7 +306,7 @@ bool llvm::SimplifyInstructionsInBlock(BasicBlock *BB, const TargetData *TD) {
|
|||||||
WeakVH BIHandle(BI);
|
WeakVH BIHandle(BI);
|
||||||
ReplaceAndSimplifyAllUses(Inst, V, TD);
|
ReplaceAndSimplifyAllUses(Inst, V, TD);
|
||||||
MadeChange = true;
|
MadeChange = true;
|
||||||
if (BIHandle == 0)
|
if (BIHandle != BI)
|
||||||
BI = BB->begin();
|
BI = BB->begin();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -354,12 +354,13 @@ void llvm::RemovePredecessorAndSimplify(BasicBlock *BB, BasicBlock *Pred,
|
|||||||
// value into all of its uses.
|
// value into all of its uses.
|
||||||
assert(PNV != PN && "hasConstantValue broken");
|
assert(PNV != PN && "hasConstantValue broken");
|
||||||
|
|
||||||
|
Value *OldPhiIt = PhiIt;
|
||||||
ReplaceAndSimplifyAllUses(PN, PNV, TD);
|
ReplaceAndSimplifyAllUses(PN, PNV, TD);
|
||||||
|
|
||||||
// If recursive simplification ended up deleting the next PHI node we would
|
// If recursive simplification ended up deleting the next PHI node we would
|
||||||
// iterate to, then our iterator is invalid, restart scanning from the top
|
// iterate to, then our iterator is invalid, restart scanning from the top
|
||||||
// of the block.
|
// of the block.
|
||||||
if (PhiIt == 0) PhiIt = &BB->front();
|
if (PhiIt != OldPhiIt) PhiIt = &BB->front();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user