[llvm] [DebugInfo][RemoveDIs] Don't allocate one DPMarker per instruction (PR #79345)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 06:51:17 PST 2024


================
@@ -212,14 +208,13 @@ void Instruction::moveBeforeImpl(BasicBlock &BB, InstListType::iterator I,
   BB.getInstList().splice(I, getParent()->getInstList(), getIterator());
 
   if (BB.IsNewDbgInfoFormat && !Preserve) {
-    if (!DbgMarker)
-      BB.createMarker(this);
     DPMarker *NextMarker = getParent()->getNextMarker(this);
 
     // If we're inserting at point I, and not in front of the DPValues attached
     // there, then we should absorb the DPValues attached to I.
-    if (NextMarker && !InsertAtHead)
-      DbgMarker->absorbDebugValues(*NextMarker, false);
+    if (!InsertAtHead && NextMarker && !NextMarker->empty()) {
+      adoptDbgValues(&BB, I, false);
----------------
jmorse wrote:

Hmmm, I was going to say "because we never have trailing DPValues here" (i.e. ones hanging off the end of the block), but I'm now seeing various scenarios where moveBefore is called with the end() iterator. And the assertion on moveBeforeImpl's entry explicitly takes account of that. So this would need some cleanup.

It's probably better to fold all that maintenance code into adoptDbgValues, I suppose I'll look at that next.

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


More information about the llvm-commits mailing list