[PATCH] D140900: [DebugInfo] Print empty MDTuples wrapped in MetadataAsValue inline

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 09:03:41 PST 2023


Orlando created this revision.
Orlando added reviewers: StephenTozer, jmorse, djtodoro, jryans, scott.linder.
Orlando added a project: debug-info.
Herald added a subscriber: hiraditya.
Herald added a project: All.
Orlando requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This improves the readability of debugging intrinsics. Instead of:

  call void @llvm.dbg.value(metadata !2, ...)
  !2 = !{}

We will see:

  call void @llvm.dbg.value(metadata !{}, ...)
  !2 = !{}

Note that we still get a numbered metadata entry for the node even if it's not
used elsewhere. This is to avoid adding more context to the print functions.

This is already legal IR - LLVM can parse and understand it - so there is no
need to update the parser.

The next patches in this stack will make such empty metadata operands more
common and semantically important.

Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value


https://reviews.llvm.org/D140900

Files:
  llvm/lib/IR/AsmWriter.cpp
  llvm/test/DebugInfo/Generic/empty-metadata-roundtrip.ll
  llvm/test/Transforms/GlobalOpt/localize-constexpr-debuginfo.ll
  llvm/test/Transforms/GlobalOpt/metadata.ll
  llvm/test/Transforms/LoopIdiom/debug-line.ll
  llvm/unittests/IR/MetadataTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140900.485990.patch
Type: text/x-patch
Size: 6962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230103/429e3a07/attachment.bin>


More information about the llvm-commits mailing list