[PATCH] D154080: [DebugInfo][RemoveDIs] Add conversion utilities between dbg.value form and DPValue new-debug-info form

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 06:51:37 PDT 2023


jmorse created this revision.
jmorse added reviewers: Orlando, StephenTozer, probinson.
Herald added subscribers: Enna1, ormris, foad, kerbowa, hiraditya, jvesely, arsenm.
Herald added a project: All.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch contributes some more plumbing to the "removing debug intrinsics" design: specifically utility methods for converting from one format into another. As it stands, it's going to be possible for blocks to move between "dbg.value" format (intrinsics) and "DPValue" format (no intrinsics) as needs be. As a result, Modules / Functions / Blocks grow a Boolean flag to indicate which format they currently contain, and have helper methods to initiate transferring from one to the other.

There's no consideration for serialising the flag to textual IR or bitcode: this is purely an in-memory representation right now. There's a "validate" method added to blocks to check that the debug-info isn't obviously broken, this is a smoke test rather than something the Verifier needs to be rigorous about.

There are a few places where we scatter calls to set the "IsNewDbgInfoFormat" flag on block or function creation: normally the functions and blocks have the flag set when they're inserted into their parent, but in a few scenarios debug-info sensitive operations occur before that happens, therefore the flag has to be explicitly set on creation. This feels fairly dumb, but it's all in aid of migration/transition rather than a long term code decision.

The unit test added takes a function with dbg.values, converts it to the new DPValue form, and confirms that the layout of the data structures is as expected, and that we can convert back to exactly the same format.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154080

Files:
  llvm/include/llvm/IR/BasicBlock.h
  llvm/include/llvm/IR/Function.h
  llvm/include/llvm/IR/Module.h
  llvm/lib/IR/BasicBlock.cpp
  llvm/lib/IR/Function.cpp
  llvm/lib/IR/Module.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Linker/IRMover.cpp
  llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
  llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
  llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
  llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
  llvm/lib/Transforms/Utils/CloneFunction.cpp
  llvm/unittests/IR/DebugInfoTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154080.535765.patch
Type: text/x-patch
Size: 23373 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230629/29eb5bb3/attachment.bin>


More information about the llvm-commits mailing list