This patch adjusts _when_ something happens in LiveDebugValues / InstrRefBasedLDV, to make it more amenable to dealing with DBG_INSTR_REF instructions. There's no functional change.
In the current base InstrRefBasedLDV implementation, we collect the machine value-number transfer function for blocks at the same time as the variable-value transfer function. After solving machine value numbers, the variable-value transfer function is updated so that DBG_VALUEs of live-in registers have the correct value. The same would need to be done for DBG_INSTR_REFs, to connect instruction-references with machine value numbers.
Rather than writing more code for that, this patch makes things slightly simpler:
- We collect the (machine-value-number) transfer function and solve for machine value numbers,
- Then step through the MachineInstrs again collecting the variable value transfer function.
The change is that linking up variable values with how they're defined (as being in a register, or as an instruction reference) is done as we step through the MachineInstrs, instead of on-the-fly. This is slower (in terms of compile time performance) but makes the next patch much easier to understand.
can this be for (MachineBasicBlock &MBB : OrderToBB) ?