Find anchoring end points for repairIntervalsInRange and repairIndexesInRange

automatically.

llvm-svn: 175673
This commit is contained in:
Cameron Zwarich 2013-02-20 22:10:00 +00:00
parent dd619b6db9
commit 3066cd30a4
3 changed files with 21 additions and 12 deletions

View File

@ -1038,6 +1038,13 @@ LiveIntervals::repairIntervalsInRange(MachineBasicBlock *MBB,
MachineBasicBlock::iterator Begin, MachineBasicBlock::iterator Begin,
MachineBasicBlock::iterator End, MachineBasicBlock::iterator End,
ArrayRef<unsigned> OrigRegs) { 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; SlotIndex endIdx;
if (End == MBB->end()) if (End == MBB->end())
endIdx = getMBBEndIdx(MBB).getPrevSlot(); endIdx = getMBBEndIdx(MBB).getPrevSlot();

View File

@ -146,6 +146,15 @@ void SlotIndexes::renumberIndexes(IndexList::iterator curItr) {
void SlotIndexes::repairIndexesInRange(MachineBasicBlock *MBB, void SlotIndexes::repairIndexesInRange(MachineBasicBlock *MBB,
MachineBasicBlock::iterator Begin, MachineBasicBlock::iterator Begin,
MachineBasicBlock::iterator End) { 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()); bool includeStart = (Begin == MBB->begin());
SlotIndex startIdx; SlotIndex startIdx;
if (includeStart) if (includeStart)

View File

@ -1150,15 +1150,8 @@ tryInstructionTransform(MachineBasicBlock::iterator &mi,
LV->addVirtualRegisterKilled(Reg, NewMIs[1]); LV->addVirtualRegisterKilled(Reg, NewMIs[1]);
} }
MachineBasicBlock::iterator Begin;
MachineBasicBlock::iterator End;
SmallVector<unsigned, 4> OrigRegs; SmallVector<unsigned, 4> OrigRegs;
if (LIS) { 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(), for (MachineInstr::const_mop_iterator MOI = MI.operands_begin(),
MOE = MI.operands_end(); MOI != MOE; ++MOI) { MOE = MI.operands_end(); MOI != MOE; ++MOI) {
if (MOI->isReg()) if (MOI->isReg())
@ -1169,8 +1162,11 @@ tryInstructionTransform(MachineBasicBlock::iterator &mi,
MI.eraseFromParent(); MI.eraseFromParent();
// Update LiveIntervals. // Update LiveIntervals.
if (LIS) if (LIS) {
MachineBasicBlock::iterator Begin(NewMIs[0]);
MachineBasicBlock::iterator End(NewMIs[1]);
LIS->repairIntervalsInRange(MBB, Begin, End, OrigRegs); LIS->repairIntervalsInRange(MBB, Begin, End, OrigRegs);
}
mi = NewMIs[1]; mi = NewMIs[1];
if (TransformSuccess) if (TransformSuccess)
@ -1576,9 +1572,6 @@ eliminateRegSequence(MachineBasicBlock::iterator &MBBI) {
} }
// Udpate LiveIntervals. // Udpate LiveIntervals.
if (LIS) { if (LIS)
if (MBBI != MBB->begin())
--MBBI;
LIS->repairIntervalsInRange(MBB, MBBI, EndMBBI, OrigRegs); LIS->repairIntervalsInRange(MBB, MBBI, EndMBBI, OrigRegs);
}
} }