[llvm] [Transforms] Remove unused replaceDbgUsesWithUndef (PR #218215)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 23 00:41:56 PDT 2026


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/218215

The last use was removed on Mar 5, 2026 in
commit e3b62ffcd8592cf234174057b4581adb1eecbf9c.


>From 21fb0806c7dd45c533dc81255ae63bbd8200c4b2 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 9 Aug 2026 00:50:44 -0700
Subject: [PATCH] [Transforms] Remove unused replaceDbgUsesWithUndef

The last use was removed on Mar 5, 2026 in
commit e3b62ffcd8592cf234174057b4581adb1eecbf9c.
---
 llvm/include/llvm/Transforms/Utils/Local.h | 6 ------
 llvm/lib/Transforms/Utils/Local.cpp        | 8 --------
 2 files changed, 14 deletions(-)

diff --git a/llvm/include/llvm/Transforms/Utils/Local.h b/llvm/include/llvm/Transforms/Utils/Local.h
index f07b2f0ba3bdd..4644ca15a946e 100644
--- a/llvm/include/llvm/Transforms/Utils/Local.h
+++ b/llvm/include/llvm/Transforms/Utils/Local.h
@@ -144,12 +144,6 @@ LLVM_ABI bool
 SimplifyInstructionsInBlock(BasicBlock *BB,
                             const TargetLibraryInfo *TLI = nullptr);
 
-/// Replace all the uses of an SSA value in @llvm.dbg intrinsics with
-/// undef. This is useful for signaling that a variable, e.g. has been
-/// found dead and hence it's unavailable at a given program point.
-/// Returns true if the dbg values have been changed.
-LLVM_ABI bool replaceDbgUsesWithUndef(Instruction *I);
-
 //===----------------------------------------------------------------------===//
 //  Control Flow Graph Restructuring.
 //
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index f5d2d0aadd7c8..29bd7c4dba51e 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -609,14 +609,6 @@ void llvm::RecursivelyDeleteTriviallyDeadInstructions(
   }
 }
 
-bool llvm::replaceDbgUsesWithUndef(Instruction *I) {
-  SmallVector<DbgVariableRecord *, 1> DPUsers;
-  findDbgUsers(I, DPUsers);
-  for (auto *DVR : DPUsers)
-    DVR->setKillLocation();
-  return !DPUsers.empty();
-}
-
 /// areAllUsesEqual - Check whether the uses of a value are all the same.
 /// This is similar to Instruction::hasOneUse() except this will also return
 /// true when there are no uses or multiple uses that all refer to the same



More information about the llvm-commits mailing list