[llvm] [DebugInfo][NewGVN] Fix debug value loss (PR #147634)
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 14 00:50:56 PDT 2025
================
@@ -4076,6 +4077,15 @@ bool NewGVN::eliminateInstructions(Function &F) {
if (!match(DefI, m_Intrinsic<Intrinsic::ssa_copy>()))
patchReplacementInstruction(DefI, DominatingLeader);
+ SmallVector<DbgVariableIntrinsic *> DbgUsers;
+ SmallVector<DbgVariableRecord *> DVRUsers;
+ findDbgUsers(DbgUsers, DefI, &DVRUsers);
+
+ for (auto *DVI: DbgUsers)
+ DVI->replaceVariableLocationOp(DefI, DominatingLeader);
----------------
OCHyams wrote:
We're in the process of removing debug intrinsics completely, so it's fine to ignore `DbgUsers`. Also fine to leave this here for now, it will get cleaned up when `findDbgUsers` is updated. Just a note for future patches.
https://github.com/llvm/llvm-project/pull/147634
More information about the llvm-commits
mailing list