[llvm] [DebugInfo][RemoveDIs] Add local-utility plumbing for DPValues (PR #72276)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 03:21:06 PST 2023


================
@@ -3121,9 +3420,24 @@ void llvm::copyRangeMetadata(const DataLayout &DL, const LoadInst &OldLI,
 
 void llvm::dropDebugUsers(Instruction &I) {
   SmallVector<DbgVariableIntrinsic *, 1> DbgUsers;
-  findDbgUsers(DbgUsers, &I);
-  for (auto *DII : DbgUsers)
-    DII->eraseFromParent();
+  SmallVector<DPValue *, 1> DPUsers;
+  findDbgUsers(DbgUsers, &I, &DPUsers);
+  for (auto *DII : DbgUsers) {
+    if (auto *DbgValue = dyn_cast<DbgValueInst>(DII)) {
+      // Don't delete dbg.values, that's bad.
----------------
jmorse wrote:

You got me, this was an opportunistic fix and should happen some other time.

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


More information about the llvm-commits mailing list