Accept instructions that read undefined values.
[oota-llvm.git] / lib / CodeGen / LiveIntervalAnalysis.cpp
index c47c8397488e66dcf927be19d23c0eaf231e0689..d1de6a85398c0158ea7c79c5d43747da9f41e487 100644 (file)
@@ -761,7 +761,15 @@ bool LiveIntervals::shrinkToUses(LiveInterval *li,
       continue;
     SlotIndex Idx = getInstructionIndex(UseMI).getUseIndex();
     VNInfo *VNI = li->getVNInfoAt(Idx);
-    assert(VNI && "Live interval not live into reading instruction");
+    if (!VNI) {
+      // This shouldn't happen: readsVirtualRegister returns true, but there is
+      // no live value. It is likely caused by a target getting <undef> flags
+      // wrong.
+      DEBUG(dbgs() << Idx << '\t' << *UseMI
+                   << "Warning: Instr claims to read non-existent value in "
+                    << *li << '\n');
+      continue;
+    }
     if (VNI->def == Idx) {
       // Special case: An early-clobber tied operand reads and writes the
       // register one slot early.