I am introducing you to a new LLVM MIR Pass that removes redundant DBG_VALUEs that the LiveDebugVariables Pass may insert after the virtual register rewriting. It has been implemented as https://reviews.llvm.org/D105279. A similar Pass exists on the LLVM IR level (https://reviews.llvm.org/D71478). This new Pass is being placed right after the register allocator, but if we find some other place in the pipeline this could be useful, we can invoke it there as well.
On the gdb-7.11 build (used as a testbed with -g -O2), the RemoveRedundantDebugValues removed 15032 instructions, according to the LLVM statistics.
The review process is almost done, so any thoughts on this?