[PATCH] D95617: [DWARF] Inlined variables with no location should not have a DW_TAG_variable

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 07:17:44 PST 2021


jmorse created this revision.
jmorse added reviewers: dblaikie, probinson, aprantl, djtodoro.
Herald added subscribers: hiraditya, jholewinski.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Discussed in this thread:

  https://lists.llvm.org/pipermail/llvm-dev/2021-January/148139.html

DwarfDebug::collectEntityInfo accidentally distinguishes between variable locations that never have a location specified, and variable locations that have an empty location specified. The latter leads to the creation of an empty variable referring to the abstract origin:

  DW_TAG_formal_parameter
      DW_AT_abstract_origin       (0x0000005a "bar")

Which is needless and potentially misleading. This patch makes collectEntityInfo behave the same way for both ways an empty variable can be represented, by only emitting a concrete variable if it actually has a location. The added test exercises this, and checks variables are created for "normal" functions too.

The NVPTX tests fail with this; this is because they were compiled to LLVM-IR before retainedNodes was correctly tracked, apparently. I've made the following changes to reflect changes in output:

- debug-addr-class.ll: Added the list of retained nodes to the input. This causes two types to shift position in the output for reasons I don't understand.
- debug-info.ll: The size of the unit changes because we cease emitting two parameters with abstract-origins as a result of this patch
- debug-loc-offset.ll: adding retainedNodes to this makes the abbrev numbering change, and one new variable to be emitted.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95617

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/test/DebugInfo/Generic/no-empty-child-vars.ll
  llvm/test/DebugInfo/NVPTX/debug-addr-class.ll
  llvm/test/DebugInfo/NVPTX/debug-info.ll
  llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95617.319863.patch
Type: text/x-patch
Size: 24118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210128/c68b3e58/attachment.bin>


More information about the llvm-commits mailing list