mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 19:12:56 +02:00
[CodeGenPrepare] Simplify code. NFCI.
This commit is contained in:
parent
336548370d
commit
28b9fdaf5e
@ -5274,22 +5274,11 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
|
|||||||
// If we have no uses, recursively delete the value and all dead instructions
|
// If we have no uses, recursively delete the value and all dead instructions
|
||||||
// using it.
|
// using it.
|
||||||
if (Repl->use_empty()) {
|
if (Repl->use_empty()) {
|
||||||
// This can cause recursive deletion, which can invalidate our iterator.
|
resetIteratorIfInvalidatedWhileCalling(CurInstIterator->getParent(), [&]() {
|
||||||
// Use a WeakTrackingVH to hold onto it in case this happens.
|
RecursivelyDeleteTriviallyDeadInstructions(
|
||||||
Value *CurValue = &*CurInstIterator;
|
Repl, TLInfo, nullptr,
|
||||||
WeakTrackingVH IterHandle(CurValue);
|
[&](Value *V) { removeAllAssertingVHReferences(V); });
|
||||||
BasicBlock *BB = CurInstIterator->getParent();
|
});
|
||||||
|
|
||||||
RecursivelyDeleteTriviallyDeadInstructions(
|
|
||||||
Repl, TLInfo, nullptr,
|
|
||||||
[&](Value *V) { removeAllAssertingVHReferences(V); });
|
|
||||||
|
|
||||||
if (IterHandle != CurValue) {
|
|
||||||
// If the iterator instruction was recursively deleted, start over at the
|
|
||||||
// start of the block.
|
|
||||||
CurInstIterator = BB->begin();
|
|
||||||
SunkAddrs.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
++NumMemoryInsts;
|
++NumMemoryInsts;
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user