Handle DBG_INSTR_REF instructions in LiveDebugValues, to determine and propagate variable locations. The logic is fairly straight forwards:
- Collect a map of debug-instruction-number to the machine value numbers generated in the first walk through the function,
- When building the variable value transfer function and we see a DBG_INSTR_REF, look up the instruction it refers to, and pick the machine value number it generates,
- That's it; the rest of LiveDebugValues continues as normal.
Reviewing this change may be sticky, as it depends on what route we take with reviewing D83047.
Awkwardly, there are two kinds of instruction numbering happening here: the offset into the block (which is how machine value numbers are determined), and the numbers that we label instructions with when generating DBG_INSTR_REFs. Suggestions on naming them most welcome, I haven't come up with anything good yet.
Practically, the map above isn't to a set of value numbers, it's to a MachineInstr and its offset into its block. One can determine the machine value number it generates at a particular operand using that information.
I've also restructured the TransferTracker redefVar code a little, to separate some DBG_VALUE specific operations into its own method. The changes around redefVar should be largely NFC, while allowing DBG_INSTR_REFs to specify a value number rather than just a location.
???