llvm-project
51da8934 - [MIR] Avoid reusing debug instruction numbers after parsing (#244437)

Commit
19 hours ago
[MIR] Avoid reusing debug instruction numbers after parsing (#244437) When a pass allocates a debug instruction number after MIR parsing, it can get a number that is still in use. Resuming code generation from MIR can expose this in two ways: - X86FixupBWInsts, given the substitution 2 -> 1 and only instruction 1, numbers its replacement 2 and records 1 -> 2. The substitutions now form the cycle 2 -> 1 -> 2, and LiveDebugValues follows it forever when a DBG_INSTR_REF reaches it. - Given a DBG_INSTR_REF to a deleted instruction 2, the same rewrite numbers its load 2, and LiveDebugValues gives the variable the load's value instead of no location. The parser seeds the counter only from the numbers that top-level instructions carry. It now also counts the numbers on bundled instructions, DBG_PHI operands, DBG_INSTR_REF operands and debugValueSubstitutions entries. This turned up while teaching X86FixupBWInsts to widen MOV16ri, which made llc hang on dbg-value-superreg-copy2.mir.
Author
Parents
Loading