MachineBasicBlock::iterator Begin,
MachineBasicBlock::iterator End,
ArrayRef<unsigned> OrigRegs) {
+ // Find anchor points, which are at the beginning/end of blocks or at
+ // instructions that already have indexes.
+ while (Begin != MBB->begin() && !Indexes->hasIndex(Begin))
+ --Begin;
+ while (End != MBB->end() && !Indexes->hasIndex(End))
+ ++End;
+
SlotIndex endIdx;
if (End == MBB->end())
endIdx = getMBBEndIdx(MBB).getPrevSlot();
void SlotIndexes::repairIndexesInRange(MachineBasicBlock *MBB,
MachineBasicBlock::iterator Begin,
MachineBasicBlock::iterator End) {
+ // FIXME: Is this really necessary? The only caller repairIntervalsForRange()
+ // does the same thing.
+ // Find anchor points, which are at the beginning/end of blocks or at
+ // instructions that already have indexes.
+ while (Begin != MBB->begin() && !hasIndex(Begin))
+ --Begin;
+ while (End != MBB->end() && !hasIndex(End))
+ ++End;
+
bool includeStart = (Begin == MBB->begin());
SlotIndex startIdx;
if (includeStart)
LV->addVirtualRegisterKilled(Reg, NewMIs[1]);
}
- MachineBasicBlock::iterator Begin;
- MachineBasicBlock::iterator End;
SmallVector<unsigned, 4> OrigRegs;
if (LIS) {
- Begin = MachineBasicBlock::iterator(NewMIs[0]);
- if (Begin != MBB->begin())
- --Begin;
- End = llvm::next(MachineBasicBlock::iterator(MI));
-
for (MachineInstr::const_mop_iterator MOI = MI.operands_begin(),
MOE = MI.operands_end(); MOI != MOE; ++MOI) {
if (MOI->isReg())
MI.eraseFromParent();
// Update LiveIntervals.
- if (LIS)
+ if (LIS) {
+ MachineBasicBlock::iterator Begin(NewMIs[0]);
+ MachineBasicBlock::iterator End(NewMIs[1]);
LIS->repairIntervalsInRange(MBB, Begin, End, OrigRegs);
+ }
mi = NewMIs[1];
if (TransformSuccess)
}
// Udpate LiveIntervals.
- if (LIS) {
- if (MBBI != MBB->begin())
- --MBBI;
+ if (LIS)
LIS->repairIntervalsInRange(MBB, MBBI, EndMBBI, OrigRegs);
- }
}