mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 07:34:33 +00:00
Update SlotIndexes after updateTerminator() possibly removes instructions. I am
really trying to avoid piping SlotIndexes through to RemoveBranch() and friends. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174869 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4e08e35e96
commit
cbe3f5e162
@ -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