[llvm-commits] [llvm] r150220 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Thu Feb 9 17:31:31 PST 2012
Author: stoklund
Date: Thu Feb 9 19:31:31 2012
New Revision: 150220
URL: http://llvm.org/viewvc/llvm-project?rev=150220&view=rev
Log:
Constrain the regmask search space for local live ranges.
When checking a local live range for interference, restrict the binary
search to the single block.
Modified:
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=150220&r1=150219&r2=150220&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Thu Feb 9 19:31:31 2012
@@ -1161,11 +1161,21 @@
BitVector &UsableRegs) {
if (LI.empty())
return false;
+ LiveInterval::iterator LiveI = LI.begin(), LiveE = LI.end();
+
+ // Use a smaller arrays for local live ranges.
+ ArrayRef<SlotIndex> Slots;
+ ArrayRef<const uint32_t*> Bits;
+ if (MachineBasicBlock *MBB = intervalIsInOneMBB(LI)) {
+ Slots = getRegMaskSlotsInBlock(MBB->getNumber());
+ Bits = getRegMaskBitsInBlock(MBB->getNumber());
+ } else {
+ Slots = getRegMaskSlots();
+ Bits = getRegMaskBits();
+ }
// We are going to enumerate all the register mask slots contained in LI.
// Start with a binary search of RegMaskSlots to find a starting point.
- LiveInterval::iterator LiveI = LI.begin(), LiveE = LI.end();
- ArrayRef<SlotIndex> Slots = getRegMaskSlots();
ArrayRef<SlotIndex>::iterator SlotI =
std::lower_bound(Slots.begin(), Slots.end(), LiveI->start);
ArrayRef<SlotIndex>::iterator SlotE = Slots.end();
@@ -1187,7 +1197,7 @@
Found = true;
}
// Remove usable registers clobbered by this mask.
- UsableRegs.clearBitsNotInMask(RegMaskBits[SlotI-Slots.begin()]);
+ UsableRegs.clearBitsNotInMask(Bits[SlotI-Slots.begin()]);
if (++SlotI == SlotE)
return Found;
}
More information about the llvm-commits
mailing list