mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-18 21:24:32 -04:00
Recommit "[DSE] Preserve basic block ordering using OrderedBasicBlock."
Recommitting after addressing a buildbot failure. This reverts commit c87869ebea000dd6483de7c7451cb36c1d36f866. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357222 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -85,3 +85,27 @@ bool OrderedBasicBlock::dominates(const Instruction *A, const Instruction *B) {
|
||||
|
||||
return comesBefore(A, B);
|
||||
}
|
||||
|
||||
void OrderedBasicBlock::eraseInstruction(const Instruction *I) {
|
||||
if (LastInstFound != BB->end() && I == &*LastInstFound) {
|
||||
if (LastInstFound == BB->begin()) {
|
||||
LastInstFound = BB->end();
|
||||
NextInstPos = 0;
|
||||
} else
|
||||
LastInstFound--;
|
||||
}
|
||||
|
||||
NumberedInsts.erase(I);
|
||||
}
|
||||
|
||||
void OrderedBasicBlock::replaceInstruction(const Instruction *Old,
|
||||
const Instruction *New) {
|
||||
auto OI = NumberedInsts.find(Old);
|
||||
if (OI == NumberedInsts.end())
|
||||
return;
|
||||
|
||||
NumberedInsts[New] = OI->second;
|
||||
if (LastInstFound != BB->end() && Old == &*LastInstFound)
|
||||
LastInstFound = New->getIterator();
|
||||
NumberedInsts.erase(Old);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user