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

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 09:17:19 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.
----------------
OCHyams wrote:

The rest of the patch looks mechanical but this looks like a fix. Was this meant to / should it be a separate patch?

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


More information about the llvm-commits mailing list