Page MenuHomePhabricator

[InstrRef][FastISel] Emit DBG_INSTR_REF from fast-isel when using instruction-referencing
ClosedPublic

Authored by jmorse on Jul 9 2021, 5:02 AM.

Details

Summary

If you attach attribute((optnone)) to a function when using optimisations, that function will use fast-isel instead of the usual SelectionDAG method. This is a problem for instruction referencing, because it means DBG_VALUEs of virtual registers will be created, triggering some safety assertions in LiveDebugVariables. Those assertions exist to detect exactly this scenario, where an unexpected piece of code is generating virtual register references in instruction referencing mode.

Fix this by transforming the DBG_VALUEs created by fast-isel into half-formed DBG_INSTR_REFs, after which they get patched up in finalizeDebugInstrRefs. The test modified adds a fast-isel mode to the instruction referencing isel test.

Diff Detail

Event Timeline

jmorse created this revision.Jul 9 2021, 5:02 AM
jmorse requested review of this revision.Jul 9 2021, 5:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2021, 5:02 AM
jmorse added a comment.Jul 9 2021, 5:10 AM

Uh, actually the dbg.declare scenario isn't covered, I'll revise a test for that in...

jmorse updated this revision to Diff 357498.Jul 9 2021, 6:33 AM

Add test for dbg.declares. Prepend a deref on the DIExpression of DBG_INSTR_REFs that correspond to dbg.declares.

StephenTozer accepted this revision.Jul 16 2021, 5:29 AM
StephenTozer added a subscriber: StephenTozer.

The change looks simple enough, and the test coverage is good: LGTM.

This revision is now accepted and ready to land.Jul 16 2021, 5:29 AM
This revision was landed with ongoing or failed builds.Jul 16 2021, 5:56 AM
This revision was automatically updated to reflect the committed changes.