This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][InstrRef] Accept landingpad block arguments
ClosedPublic

Authored by jmorse on Aug 31 2021, 10:05 AM.

Details

Summary

This patch makes instruction-referencing accepts an additional scenario where values can be read from physical registers at the start of blocks. As far as I was aware, this only happened:

  • With arguments in the entry block,
  • With constant physical registers,

To which this patch adds a third case:

  • With exception-handling landing-pad blocks.

Observe the llvm-ir in the attached test: the operand of the dbg.value traces back to the "landingpad" instruction, which becomes some copies from physregs. Right now, that's deemed unacceptable, and the assertion fires.

The fix is to just accept this scenario; this is a case where the value in question is defined by a register and a position, not by an instruction that defines it. Reading it with a DBG_PHI is the correct behaviour, there isn't a non-copy instruction that we can refer to.

Diff Detail

Event Timeline

jmorse created this revision.Aug 31 2021, 10:05 AM
jmorse requested review of this revision.Aug 31 2021, 10:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2021, 10:05 AM

LGTM. Please appease clang-format bot before landing.

llvm/test/DebugInfo/X86/instr-ref-eh-landing-pad.ll
32–33

Is that an accidental newline in there?

Orlando accepted this revision.Sep 1 2021, 7:25 AM
This revision is now accepted and ready to land.Sep 1 2021, 7:25 AM
jmorse added inline comments.Oct 4 2021, 3:01 PM
llvm/test/DebugInfo/X86/instr-ref-eh-landing-pad.ll
32–33

This is how the IR printer chooses to render it -- not completely sure why, but it's canonical at the least.

This revision was landed with ongoing or failed builds.Oct 4 2021, 3:10 PM
This revision was automatically updated to reflect the committed changes.