Use LiveRangeQuery for instruction-level liveness queries.

Remove redundant or bug-prone LiveInterval APIs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189685 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/LiveRangeEdit.cpp b/lib/CodeGen/LiveRangeEdit.cpp
index 8627111..9c374b1 100644
--- a/lib/CodeGen/LiveRangeEdit.cpp
+++ b/lib/CodeGen/LiveRangeEdit.cpp
@@ -278,7 +278,7 @@
     // Always shrink COPY uses that probably come from live range splitting.
     if (MI->readsVirtualRegister(Reg) &&
         (MI->isCopy() || MOI->isDef() || MRI.hasOneNonDBGUse(Reg) ||
-         LI.isKilledAtInstr(Idx)))
+         LiveRangeQuery(LI, Idx).isKill()))
       ToShrink.insert(&LI);
 
     // Remove defined value.
diff --git a/lib/CodeGen/RegisterPressure.cpp b/lib/CodeGen/RegisterPressure.cpp
index 1be203f..27da370 100644
--- a/lib/CodeGen/RegisterPressure.cpp
+++ b/lib/CodeGen/RegisterPressure.cpp
@@ -500,8 +500,9 @@
       if (RequireIntervals) {
         const LiveInterval *LI = getInterval(Reg);
         // Check if this LR is killed and not redefined here.
-        if (LI && !LI->isKilledAtInstr(SlotIdx)
-            && !LI->isDefinedByInstr(SlotIdx)) {
+        if (LI) {
+          LiveRangeQuery LRQ(*LI, SlotIdx);
+          if (!LRQ.isKill() && !LRQ.valueDefined())
             discoverLiveOut(Reg);
         }
       }
@@ -558,7 +559,7 @@
     bool lastUse = false;
     if (RequireIntervals) {
       const LiveInterval *LI = getInterval(Reg);
-      lastUse = LI && LI->isKilledAtInstr(SlotIdx);
+      lastUse = LI && LiveRangeQuery(*LI, SlotIdx).isKill();
     }
     else {
       // Allocatable physregs are always single-use before register rewriting.
@@ -882,9 +883,10 @@
       // to be bottom-scheduled to avoid searching uses at each query.
       SlotIndex CurrIdx = getCurrSlot();
       const LiveInterval *LI = getInterval(Reg);
-      if (LI && LI->isKilledAtInstr(SlotIdx)
-          && !findUseBetween(Reg, CurrIdx, SlotIdx, MRI, LIS)) {
-        decreaseRegPressure(Reg);
+      if (LI) {
+        LiveRangeQuery LRQ(*LI, SlotIdx);
+        if (LRQ.isKill() && !findUseBetween(Reg, CurrIdx, SlotIdx, MRI, LIS))
+          decreaseRegPressure(Reg);
       }
     }
     else if (!TargetRegisterInfo::isVirtualRegister(Reg)) {