Replace LiveInterval::killedAt with isKilledAtInstr.
authorAndrew Trick <atrick@apple.com>
Fri, 30 Aug 2013 04:31:01 +0000 (04:31 +0000)
committerAndrew Trick <atrick@apple.com>
Fri, 30 Aug 2013 04:31:01 +0000 (04:31 +0000)
Return true for LRGs that end at EarlyClobber or Register slots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189642 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/LiveInterval.h
lib/CodeGen/LiveRangeEdit.cpp
lib/CodeGen/RegisterPressure.cpp

index 6361c3570cd94d4e2b122d6c5c7f0c56f3830c2a..058f95e24e60556435467507f3ff298827b77d32 100644 (file)
@@ -287,12 +287,13 @@ namespace llvm {
       return r != end() && r->start <= index;
     }
 
-    /// killedAt - Return true if a live range ends at index. Note that the kill
-    /// point is not contained in the half-open live range. It is usually the
-    /// getDefIndex() slot following its last use.
-    bool killedAt(SlotIndex index) const {
-      const_iterator r = find(index.getRegSlot(true));
-      return r != end() && r->end == index;
+    /// Return true if a live range ends at the instruction at this index. Note
+    /// that the kill point is not contained in the half-open live range. It is
+    /// usually the EarlyClobber or Register slot following its last use.
+    bool isKilledAtInstr(SlotIndex index) const {
+      SlotIndex BaseIdx = index.getBaseIndex();
+      const_iterator r = find(BaseIdx);
+      return r != end() && r->end.getBaseIndex() == BaseIdx;
     }
 
     /// getLiveRangeContaining - Return the live range that contains the
index ca64729ab90aabab6c40e2df32459810bf5c4641..86271116f4e07799ed8903001f7b79e9631959e3 100644 (file)
@@ -278,7 +278,7 @@ void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink) {
     // Always shrink COPY uses that probably come from live range splitting.
     if (MI->readsVirtualRegister(Reg) &&
         (MI->isCopy() || MOI->isDef() || MRI.hasOneNonDBGUse(Reg) ||
-         LI.killedAt(Idx)))
+         LI.isKilledAtInstr(Idx)))
       ToShrink.insert(&LI);
 
     // Remove defined value.
index 188750dbc005557bc6ca875af043235baa51b221..8328b500af16a3fc5751a7b7a8377bd143b5ca8f 100644 (file)
@@ -496,7 +496,7 @@ bool RegPressureTracker::recede(PressureDiff *PDiff) {
       // Adjust liveouts if LiveIntervals are available.
       if (RequireIntervals) {
         const LiveInterval *LI = getInterval(Reg);
-        if (LI && !LI->killedAt(SlotIdx))
+        if (LI && !LI->isKilledAtInstr(SlotIdx))
           discoverLiveOut(Reg);
       }
       increaseRegPressure(Reg);
@@ -550,7 +550,7 @@ bool RegPressureTracker::advance() {
     bool lastUse = false;
     if (RequireIntervals) {
       const LiveInterval *LI = getInterval(Reg);
-      lastUse = LI && LI->killedAt(SlotIdx);
+      lastUse = LI && LI->isKilledAtInstr(SlotIdx);
     }
     else {
       // Allocatable physregs are always single-use before register rewriting.
@@ -886,7 +886,7 @@ void RegPressureTracker::bumpDownwardPressure(const MachineInstr *MI) {
       // to be bottom-scheduled to avoid searching uses at each query.
       SlotIndex CurrIdx = getCurrSlot();
       const LiveInterval *LI = getInterval(Reg);
-      if (LI && LI->killedAt(SlotIdx)
+      if (LI && LI->isKilledAtInstr(SlotIdx)
           && !findUseBetween(Reg, CurrIdx, SlotIdx, MRI, LIS)) {
         decreaseRegPressure(Reg);
       }