Don't rely on the isDead() MachineOperand flag when updating LiveIntervals.
authorCameron Zwarich <zwarich@apple.com>
Thu, 21 Feb 2013 08:51:58 +0000 (08:51 +0000)
committerCameron Zwarich <zwarich@apple.com>
Thu, 21 Feb 2013 08:51:58 +0000 (08:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175732 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/PHIElimination.cpp

index b84d9d33398a32db416df8d7cecf85f94ac592c2..5584708eae36bdbf5dcf22b7381fb22107a0ad72 100644 (file)
@@ -320,7 +320,9 @@ void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
     }
 
     LiveInterval &DestLI = LIS->getInterval(DestReg);
-    if (NewInstr->getOperand(0).isDead()) {
+    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.