Allow for more than one DBG_VALUE targeting the
same dead instruction.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95890 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/DeadMachineInstructionElim.cpp b/lib/CodeGen/DeadMachineInstructionElim.cpp
index 6e01e59..7ed1a6a 100644
--- a/lib/CodeGen/DeadMachineInstructionElim.cpp
+++ b/lib/CodeGen/DeadMachineInstructionElim.cpp
@@ -117,10 +117,10 @@
         // the former operand will then be deleted normally.
         if (MI->getNumOperands()==3 && MI->getOperand(0).isReg()) {
           unsigned Reg = MI->getOperand(0).getReg();
-          MachineRegisterInfo::use_iterator I = MRI->use_begin(Reg);
-          assert(I != MRI->use_end());
-          if (++I == MRI->use_end())
-            // only one use, which must be this DBG_VALUE.
+          MachineRegisterInfo::use_nodbg_iterator I = MRI->use_nodbg_begin(Reg);
+          if (I == MRI->use_nodbg_end())
+            // All uses are DBG_VALUEs.  Nullify this one; if we find
+            // others later we will nullify them then.
             MI->getOperand(0).setReg(0U);
         }
       }