Remove unused variable.
[oota-llvm.git] / lib / CodeGen / PHIElimination.cpp
index 37e2ee1fae16f463fe3400c05350e53afd1a0de3..5584708eae36bdbf5dcf22b7381fb22107a0ad72 100644 (file)
@@ -172,9 +172,6 @@ bool PHIElimination::runOnMachineFunction(MachineFunction &MF) {
   ImpDefs.clear();
   VRegPHIUseCount.clear();
 
-  if (LIS)
-    MF.verify(this, "After PHI elimination");
-
   return Changed;
 }
 
@@ -306,10 +303,9 @@ void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
   // Update LiveIntervals for the new copy or implicit def.
   if (LIS) {
     MachineInstr *NewInstr = prior(AfterPHIsIt);
-    LIS->InsertMachineInstrInMaps(NewInstr);
+    SlotIndex DestCopyIndex = LIS->InsertMachineInstrInMaps(NewInstr);
 
     SlotIndex MBBStartIndex = LIS->getMBBStartIdx(&MBB);
-    SlotIndex DestCopyIndex = LIS->getInstructionIndex(NewInstr);
     if (IncomingReg) {
       // Add the region from the beginning of MBB to the copy instruction to
       // IncomingReg's live interval.
@@ -323,8 +319,10 @@ void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
                                     IncomingVNI));
     }
 
-    LiveInterval &DestLI = LIS->getOrCreateInterval(DestReg);
-    if (NewInstr->getOperand(0).isDead()) {
+    LiveInterval &DestLI = LIS->getInterval(DestReg);
+    assert(DestLI.begin() != DestLI.end() &&
+           "PHIs should have nonempty LiveIntervals.");
+    if (DestLI.endIndex().isDead()) {
       // A dead PHI's live range begins and ends at the start of the MBB, but
       // the lowered copy, which will still be dead, needs to begin and end at
       // the copy instruction.