Use getMBBEndIdx rather than assuming that the end is right after the last instructio...
authorOwen Anderson <resistor@mac.com>
Mon, 23 Jun 2008 22:12:23 +0000 (22:12 +0000)
committerOwen Anderson <resistor@mac.com>
Mon, 23 Jun 2008 22:12:23 +0000 (22:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52649 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SimpleRegisterCoalescing.cpp

index ed295ac00713cca457706d7008d7c54caa8b22d7..bc833633ed24f05cb43fa5458e1605b02ee6e3b3 100644 (file)
@@ -443,7 +443,7 @@ bool SimpleRegisterCoalescing::isBackEdgeCopy(MachineInstr *CopyMI,
     LI.FindLiveRangeContaining(li_->getDefIndex(DefIdx));
   if (DstLR == LI.end())
     return false;
-  unsigned KillIdx = li_->getInstructionIndex(&MBB->back()) + InstrSlots::NUM;
+  unsigned KillIdx = li_->getMBBEndIdx(MBB) + 1;
   if (DstLR->valno->kills.size() == 1 &&
       DstLR->valno->kills[0] == KillIdx && DstLR->valno->hasPHIKill)
     return true;