[llvm] [DebugInfo][NewGVN] Fix debug value loss (PR #147634)
Shan Huang via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 9 05:29:45 PDT 2025
================
@@ -4076,6 +4076,7 @@ bool NewGVN::eliminateInstructions(Function &F) {
if (!match(DefI, m_Intrinsic<Intrinsic::ssa_copy>()))
patchReplacementInstruction(DefI, DominatingLeader);
+ salvageDebugInfo(*DefI);
----------------
Apochens wrote:
That would be a solution, but that would introduce some unnecessary computation overhead of salvaging. For example, salvaging the store instructions in `InstructionsToErase` is unnecessary:
https://github.com/llvm/llvm-project/blob/6c8c836b4f5a0b519db6f97c4882c6c061edd004/llvm/lib/Transforms/Scalar/NewGVN.cpp#L4194-L4196
So, I didn't place this salvage into the loop but place it just before where the salvageable instructions are marked for deletion. But if this unnecessary compulation is acceptable, I can move this salvage into the loop.
https://github.com/llvm/llvm-project/pull/147634
More information about the llvm-commits
mailing list