[llvm] [DebugInfo][RemoveDIs] Instrument loop-deletion for DPValues (PR #73042)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 23 04:07:27 PST 2023


================
@@ -628,6 +629,24 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE,
                    "Unexpected user in reachable block");
           U.set(Poison);
         }
+
+        // RemoveDIs: do the same as below for DPValues.
+        if (Block->IsNewDbgInfoFormat) {
+          for (DPValue &DPV : llvm::make_early_inc_range(I.getDbgValueRange())) {
+            auto Key =
+                DeadDebugSet.find(DebugVariable(DPV.getVariable(), DPV.getExpression(), nullptr));
+            if (Key != DeadDebugSet.end())
+              continue;
+            // Unlinks the DPV from it's container, for later insertion.
+            DPV.removeFromParent();
+            DeadDebugSet.insert(DebugVariable(DPV.getVariable(), DPV.getExpression(), nullptr));
+            DeadDPValues.push_back(&DPV);
----------------
jmorse wrote:

I guess that makes sense. It also looks like you fixed a past bug in 88d34d4626 (only var/expr for uniqueness, no DILocation) and we haven't been noticing it when repeatedly rebasing these patches, I'll shoe-horn that in too.

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


More information about the llvm-commits mailing list