[llvm] [DebugInfo][NewGVN] Fix debug value loss (PR #147634)

Shan Huang via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 12 19:51:29 PDT 2025


Apochens wrote:

> Could we replace the debug-use of `%add2` with the `%add1` instead of salvaging it?

@OCHyams We could do this in this test case. However, in other cases, there may not be an equivalent instruction like `%add1` to replace the deleted instruction. Here is an example: https://godbolt.org/z/Mvj9hM1P6. As a result, I think salvaging is a more general and appropriate solution. Or we add some checks into the optimization and only perform the replacement when the checks pass?

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


More information about the llvm-commits mailing list