[PATCH] D70350: [DWARF] Allow cross-CU references of subprogram definitions

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 15 16:09:13 PST 2019


vsk created this revision.
vsk added reviewers: dblaikie, aprantl, dexonsmith.
Herald added subscribers: llvm-commits, steven_wu, hiraditya, mehdi_amini.
Herald added a project: LLVM.

This allows a call site tag in CU A to reference a callee DIE in CU B
without resorting to creating an incomplete duplicate DIE for the callee
inside of CU A.

We already allow cross-CU references of subprogram declarations, so it
doesn't seem like definitions ought to be special.

This improves entry value evaluation and tail call frame synthesis in
the LTO setting. During LTO, it's common for cross-module inlining to
produce a call in some CU A where the callee resides in a different CU,
and there is no declaration subprogram for the callee anywhere. In this
case llvm would (unnecessarily, I think) emit an empty DW_TAG_subprogram
in order to fill in the call site tag. That empty 'definition' defeats
entry value evaluation etc., because the debugger can't figure out what
it means.

As a follow-up, maybe we could add a DWARF verifier check that a
DW_TAG_subprogram at least has a DW_AT_name attribute.

rdar://46577651


https://reviews.llvm.org/D70350

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  llvm/test/DebugInfo/X86/lto-cross-cu-call-origin-ref.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70350.229659.patch
Type: text/x-patch
Size: 5472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191116/b033fb25/attachment-0001.bin>


More information about the llvm-commits mailing list