Teach the fast register allocator to update DBG_VALUE instructions when
it reloads a vreg.
Specifically, when a machine operand can be killed, point the DBG_VALUE
uses of that operand to a replacement vreg and update LiveDbgValuesMap.
Differential D43427
[RegAllocFast] Salvage debug values when killing operands vsk on Feb 16 2018, 7:00 PM. Authored by
Details
Diff Detail Event TimelineComment Actions Here's what the end-to-end test looks like before and after this patch (along with https://reviews.llvm.org/D43386 applied). Target 0: (e2e.Os.before) stopped. (lldb) fr v (S) s = (x = -16843010, y = "ab", z = 3.1415926540000001) (int) x = <no location, value may have been optimized out> (char) y1 = <no location, value may have been optimized out> (double) z = <no location, value may have been optimized out> Target 0: (e2e.Os.after) stopped. (lldb) fr v (double) z = 3.1415926540000001 (char) y1 = 'b' (int) x = -16843010 (S) s = (x = -16843010, y = "ab", z = 3.1415926540000001) Comment Actions The debug info part of this looks fine to me, it would be great if the same function could also be applied to the other register allocators. Comment Actions @aprantl thanks for the feedback, I'll take a look at whether MachineRegisterInfo is the right place for generic register allocator helpers to live. A side note: I won't get back to this patch for a few days, as I need to take a look at Swift bugs.
Comment Actions
A debugify MIR pass :-) Joke aside, that would probably by overkill. In practice -stop-before=regalloc and manually inserting DBG_VALUEs should be fine. Comment Actions
Comment Actions
Comment Actions Now that we've reverted r325438, we'll need some replacement before this patch is relevant.
I'll look into this.
It sounds like this at least needs better testing. I'm not sure whether we do the right thing if there are dbg_value uses of the dying vreg before the copy.
Yes, I'll fix the commit message. |
Note: This probably shouldn't be called unless we've actually updated any uses.