[MachineSink][DebugInfo] Correctly sink DBG_VALUEs
authorJeremy Morse <jeremy.morse.llvm@gmail.com>
Fri, 2 Nov 2018 16:52:48 +0000 (16:52 +0000)
committerJeremy Morse <jeremy.morse.llvm@gmail.com>
Fri, 2 Nov 2018 16:52:48 +0000 (16:52 +0000)
commitd538352b3e4b1eabee02fc7ce491728678cc4716
tree8e610ac20334332a92701d38b3e09c6708d6a0dd
parent82536501c75c60c5a2a0bda9e255a51ce7741018
[MachineSink][DebugInfo] Correctly sink DBG_VALUEs

As reported in PR38952, postra-machine-sink relies on DBG_VALUE insns being
adjacent to the def of the register that they reference. This is not always
true, leading to register copies being sunk but not the associated DBG_VALUEs,
which gives the debugger a bad variable location.

This patch collects DBG_VALUEs as we walk through a BB looking for copies to
sink, then passes them down to performSink. Compile-time impact should be
negligable.

Differential Revision: https://reviews.llvm.org/D53992

llvm-svn: 345996
llvm/lib/CodeGen/MachineSink.cpp
llvm/test/CodeGen/X86/pr38952.mir [new file with mode: 0644]