[DebugInfo][InstrRef] Add extra indirection for NRVO tests
authorJeremy Morse <jeremy.morse@sony.com>
Thu, 25 Nov 2021 21:41:55 +0000 (21:41 +0000)
committerJeremy Morse <jeremy.morse@sony.com>
Thu, 25 Nov 2021 21:43:38 +0000 (21:43 +0000)
commit536b9eb31e9333bcee3d20d694f7cb12d1ff3d89
treef94cfe89f05812656dc0d344e71240e2bb1df1ea
parent5162b558d8c0b542e752b037e72a69d5fd51eb1e
[DebugInfo][InstrRef] Add extra indirection for NRVO tests

In some scenarios, usually involving NRVO, we can issue indirect DBG_VALUEs
after SelectionDAG, even in instruction referencing mode (if the variable
is an argument). If the corresponding argument value is spilt to the stack,
then we have:
 * Indirection from it being on the stack,
 * Indirection from it being a dbg.declare or a dbg.addr.

However InstrRefBasedLDV only emits one level of indirection. This patch
adds the second, by adding an extra DW_OP_deref if necessary. The two
tests modified fail otherwise -- they feature some NRVO, and require two
levels of indirection to be correct.

Differential Revision: https://reviews.llvm.org/D114364
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
llvm/test/DebugInfo/X86/spill-indirect-nrvo.ll
llvm/test/DebugInfo/X86/spill-nontrivial-param.ll