When given the -experimental-debug-variable-locations option (via -Xclang or to llc), have SelectionDAG generate DBG_INSTR_REF instructions instead of DBG_VALUE. For now, this only happens in a limited circumstance: when the value referred to is not a PHI and is defined in the current block. Other situations introduce interesting problems, which I'd prefer to not address in this first patch series.
Practically, this patch hooks into InstrEmitter and if it can find a defining instruction, gives it an instruction number, and points the DBG_INSTR_REF at that <instr, operand> pair.