This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Clear subreg in setDebugValueUndef()
ClosedPublic

Authored by dstenb on Oct 22 2020, 2:54 AM.

Details

Summary

When switching the register debug operands to $noreg in
setupDebugValueUndef() also clear the sub-register indices for virtual
registers. This is done when marking DBG_VALUEs undef in other cases,
e.g. in LiveDebugVariables. I have not found any cases where leaving the
sub-register index causes any issues, and the indices would eventually
get dropped when LiveDebugVariables reinserted the undef DBG_VALUEs
after register scheduling, but if nothing else it looked a bit weird in
printouts to have sub-register indices on $noreg, and I don't think the
sub-register index holds any meaningful information at that point.

I have not been able to find any source-level reproducer for this with
an upstream target, so I have just added an instrumented machine-sink
test.

Diff Detail

Event Timeline

dstenb created this revision.Oct 22 2020, 2:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 22 2020, 2:54 AM
dstenb requested review of this revision.Oct 22 2020, 2:54 AM
djtodoro accepted this revision.Oct 22 2020, 5:16 AM

This looks reasonable to me.

(some nits included)

llvm/test/DebugInfo/MIR/X86/machinesink-subreg.mir
24

unused, it can be deleted

65

idex --> index

This revision is now accepted and ready to land.Oct 22 2020, 5:16 AM
jmorse accepted this revision.Oct 22 2020, 7:55 AM

LGTM, I agree the subregister index on any undef DBG_VALUE is meaningless.

This revision was landed with ongoing or failed builds.Oct 22 2020, 11:51 PM
This revision was automatically updated to reflect the committed changes.
dstenb marked 2 inline comments as done.