[DebugInfo] MCP: collect and update DBG_VALUEs encountered in local block
authorJeremy Morse <jeremy.morse.llvm@gmail.com>
Wed, 14 Aug 2019 12:20:02 +0000 (12:20 +0000)
committerJeremy Morse <jeremy.morse.llvm@gmail.com>
Wed, 14 Aug 2019 12:20:02 +0000 (12:20 +0000)
commit90c2794bfc337338b4e4ec8421c75735e7207e6e
treee6660a22e5ee093dbf515355ced01d0d20effd0c
parent9fa2599e9b9cb6fd6bda81f7e3c0d70e7cbad3c6
[DebugInfo] MCP: collect and update DBG_VALUEs encountered in local block

MCP currently uses changeDebugValuesDefReg / collectDebugValues to find
debug users of a register, however those functions assume that all
DBG_VALUEs immediately follow the specified instruction, which isn't
necessarily true. This is going to become very often untrue when we turn
off CodeGenPrepare::placeDbgValues.

Instead of calling changeDebugValuesDefReg on an instruction to change its
debug users, in this patch we instead collect DBG_VALUEs of copies as we
iterate over insns, and update the debug users of copies that are made
dead. This isn't a non-functional change, because MCP will now update
DBG_VALUEs that aren't immediately after a copy, but refer to the same
register. I've hijacked the regression test for PR38773 to test for this
new behaviour, an entirely new test seemed overkill.

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

llvm-svn: 368835
llvm/include/llvm/CodeGen/MachineRegisterInfo.h
llvm/lib/CodeGen/MachineCopyPropagation.cpp
llvm/test/CodeGen/MIR/X86/pr38773.mir