[llvm] r175673 - Find anchoring end points for repairIntervalsInRange and repairIndexesInRange
Cameron Zwarich
zwarich at apple.com
Wed Feb 20 14:10:00 PST 2013
Author: zwarich
Date: Wed Feb 20 16:10:00 2013
New Revision: 175673
URL: http://llvm.org/viewvc/llvm-project?rev=175673&view=rev
Log:
Find anchoring end points for repairIntervalsInRange and repairIndexesInRange
automatically.
Modified:
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
llvm/trunk/lib/CodeGen/SlotIndexes.cpp
llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=175673&r1=175672&r2=175673&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Feb 20 16:10:00 2013
@@ -1038,6 +1038,13 @@ LiveIntervals::repairIntervalsInRange(Ma
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();
Modified: llvm/trunk/lib/CodeGen/SlotIndexes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SlotIndexes.cpp?rev=175673&r1=175672&r2=175673&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SlotIndexes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SlotIndexes.cpp Wed Feb 20 16:10:00 2013
@@ -146,6 +146,15 @@ void SlotIndexes::renumberIndexes(IndexL
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)
Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=175673&r1=175672&r2=175673&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Wed Feb 20 16:10:00 2013
@@ -1150,15 +1150,8 @@ tryInstructionTransform(MachineBasicBloc
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())
@@ -1169,8 +1162,11 @@ tryInstructionTransform(MachineBasicBloc
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)
@@ -1576,9 +1572,6 @@ eliminateRegSequence(MachineBasicBlock::
}
// Udpate LiveIntervals.
- if (LIS) {
- if (MBBI != MBB->begin())
- --MBBI;
+ if (LIS)
LIS->repairIntervalsInRange(MBB, MBBI, EndMBBI, OrigRegs);
- }
}
More information about the llvm-commits
mailing list