Fixed some tests to avoid LiveIntervals::getInstructionFromIndex(..) overhead where...
[oota-llvm.git] / lib / CodeGen / PreAllocSplitting.cpp
index ee228a9f619bef96176a172586c54bf22424f0df..68d28e4f9717da4d629b804b399ac287c0c75e13 100644 (file)
@@ -807,8 +807,7 @@ bool PreAllocSplitting::Rematerialize(unsigned VReg, VNInfo* ValNo,
   MachineBasicBlock& MBB = *RestorePt->getParent();
   
   MachineBasicBlock::iterator KillPt = BarrierMBB->end();
-  if (LIs->getInstructionFromIndex(ValNo->def) == 0 ||
-      DefMI->getParent() == BarrierMBB)
+  if (!DefMI || DefMI->getParent() == BarrierMBB)
     KillPt = findSpillPoint(BarrierMBB, Barrier, NULL, RefsInMBB);
   else
     KillPt = llvm::next(MachineBasicBlock::iterator(DefMI));
@@ -1005,7 +1004,7 @@ bool PreAllocSplitting::SplitRegLiveInterval(LiveInterval *LI) {
   SlotIndex SpillIndex;
   MachineInstr *SpillMI = NULL;
   int SS = -1;
-  if (LIs->getInstructionFromIndex(ValNo->def) == 0) {
+  if (!DefMI) {
     // If we don't know where the def is we must split just before the barrier.
     if ((SpillMI = FoldSpill(LI->reg, RC, 0, Barrier,
                             BarrierMBB, SS, RefsInMBB))) {