This is a follow up to D117877: variable assignments of DBG_VALUE $noreg, or DBG_INSTR_REFs where no value can be found, are represented as a DbgValue object with Kind "Undef". This explicitly represents "There is no value for this, and never can be". In D117877 I added a special-case to make some assignment accounting faster, without considering this scenario. It causes variables to be given the value ValueIDNum::EmptyValue, which would fail gracefully and wouldn't produce an illegal location, it'd just be discarded. However, recently that value began being entered into a DenseMap, where it's a tombstone value, causing assertions.
This patch handles that scenario and adds a regression test. The more general fix is to wrap DbgValue's ID field in Optional<>, just like the MachineOperand field is, but I'm aiming for the minimal fix right now :(