mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-26 06:04:47 +00:00
Update SlotIndexes after updateTerminator() possibly removes instructions. I am
really trying to avoid piping SlotIndexes through to RemoveBranch() and friends. llvm-svn: 174869
This commit is contained in:
parent
a494e12ad8
commit
9aa358cc0c
@ -693,8 +693,32 @@ MachineBasicBlock::SplitCriticalEdge(MachineBasicBlock *Succ, Pass *P) {
|
||||
}
|
||||
|
||||
ReplaceUsesOfBlockWith(Succ, NMBB);
|
||||
|
||||
// If updateTerminator() removes instructions, we need to remove them from
|
||||
// SlotIndexes.
|
||||
SmallVector<MachineInstr*, 4> Terminators;
|
||||
if (Indexes) {
|
||||
for (instr_iterator I = getFirstInstrTerminator(), E = instr_end();
|
||||
I != E; ++I)
|
||||
Terminators.push_back(I);
|
||||
}
|
||||
|
||||
updateTerminator();
|
||||
|
||||
if (Indexes) {
|
||||
SmallVector<MachineInstr*, 4> NewTerminators;
|
||||
for (instr_iterator I = getFirstInstrTerminator(), E = instr_end();
|
||||
I != E; ++I)
|
||||
NewTerminators.push_back(I);
|
||||
|
||||
for (SmallVectorImpl<MachineInstr*>::iterator I = Terminators.begin(),
|
||||
E = Terminators.end(); I != E; ++I) {
|
||||
if (std::find(NewTerminators.begin(), NewTerminators.end(), *I) ==
|
||||
NewTerminators.end())
|
||||
Indexes->removeMachineInstrFromMaps(*I);
|
||||
}
|
||||
}
|
||||
|
||||
// Insert unconditional "jump Succ" instruction in NMBB if necessary.
|
||||
NMBB->addSuccessor(Succ);
|
||||
if (!NMBB->isLayoutSuccessor(Succ)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user