[llvm] [DebugInfo][RemoveDIs] Avoid leaking trailing DPMarkers (PR #74458)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 06:17:48 PST 2023


================
@@ -1030,6 +1037,7 @@ void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src,
     DPMarker *TrailingDPValues = getTrailingDPValues();
     if (TrailingDPValues) {
       FirstMarker->absorbDebugValues(*TrailingDPValues, true);
+      TrailingDPValues->eraseFromParent();
----------------
jmorse wrote:

Eventually yes -- however the RemoveDIs/DDD model in-tree right now has one DPMarker allocated per instruction, and we haven't landed the plumbing required to support that (we'll get null pointer exceptions everywhere otherwise).

Over in 2f93a721eaf2aa348, which is a refactoring of the internal patch we've got, there's an "adopt" call that works very similarly to what you describe here. It might be able to automate erasing (erasal?) but still requires juggling with the trailingDPValues :(.

https://github.com/llvm/llvm-project/pull/74458


More information about the llvm-commits mailing list