[PATCH] D153990: [DebugInfo][RemoveDIs] Add prototype storage classes for non-instruction variable debug-info

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 05:51:54 PDT 2023


jmorse updated this revision to Diff 557864.
jmorse added a comment.

Here's a revised patch -- I've shifted the location of the `TrailingDPValues` data structure into `LLVMContextImpl`, as it seems we only ever have one or two blocks with trailing DPValues at a time. It doesn't make sense to bloat BasicBlock with a dedicated field for a special case. I'm planning on plumbing this through `BasicBlock`, as a result the relevant useful methods turn up in the next patch (D154080 <https://reviews.llvm.org/D154080>), so I've left an llvm_unreachable in `DPMarker::removeMarker` until that lands.

I've also shoved an assertion in LLVMContext that checks whether any DPValues get accidentally left in TrailingDPValues for the lifetime of the LLVMContext. The only scenario where I think that can happen is where someone erases a terminator and then destroys the LLVMContext? It's sort of awkward behaviour, however I think in most scenarios if you leave a datastructure in an illegal state and try to clean it up gracefully, you'll run into issues anyway.

The confusing pair of loops in `DPMarker::cloneDebugInfoFrom` have also been refactored as a I realised they can just be a single one, and I've added some comments.

Finally, I've noticed that this patch won't build independently as there are some forward declarations of stuff that doesn't have a definition, that later needs a definition -- this is due to the shifting sands of this patch series. I could jam in various shims to make it work; or I could just land the next patch at the same time, which works fine. I think that's a reasonable approach as these were only split up to make review easier anyway.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153990/new/

https://reviews.llvm.org/D153990

Files:
  llvm/include/llvm/IR/DebugInfoMetadata.h
  llvm/include/llvm/IR/DebugProgramInstruction.h
  llvm/include/llvm/IR/Instruction.h
  llvm/include/llvm/IR/Metadata.h
  llvm/lib/IR/CMakeLists.txt
  llvm/lib/IR/DebugInfoMetadata.cpp
  llvm/lib/IR/DebugProgramInstruction.cpp
  llvm/lib/IR/LLVMContextImpl.cpp
  llvm/lib/IR/LLVMContextImpl.h
  llvm/lib/IR/Metadata.cpp
  llvm/unittests/IR/DebugInfoTest.cpp
  llvm/unittests/Transforms/Utils/LocalTest.cpp
  llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153990.557864.patch
Type: text/x-patch
Size: 53619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20231024/76713708/attachment.bin>


More information about the llvm-commits mailing list