]> granicus.if.org Git - llvm/commit
[DebugInfo] Add missing DW_OP_deref when an NRVO pointer is spilled
authorReid Kleckner <rnk@google.com>
Fri, 15 Sep 2017 21:49:56 +0000 (21:49 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 15 Sep 2017 21:49:56 +0000 (21:49 +0000)
commitaf2e52282124f1810170ce7b2772ba68e9f48b66
treec822537eac50f9b18b152a2788a1d20e24728376
parent211a095ea64653c42eb85561fe0d204abcbdd624
[DebugInfo] Add missing DW_OP_deref when an NRVO pointer is spilled

Summary:
Fixes PR34513.

Indirect DBG_VALUEs typically come from dbg.declares of non-trivially
copyable C++ objects that must be passed by address. We were already
handling the case where the virtual register gets allocated to a
physical register and is later spilled. That's what usually happens for
normal parameters that aren't NRVO variables: they usually appear in
physical register parameters, and are spilled later in the function,
which would correctly add deref.

NRVO variables are different because the dbg.declare can come much later
after earlier instructions cause the incoming virtual register to be
spilled.

Also, clean up this code. We only need to look at the first operand of a
DBG_VALUE, which eliminates the operand loop.

Reviewers: aprantl, dblaikie, probinson

Subscribers: MatzeB, qcolombet, llvm-commits, hiraditya

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313399 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/MachineInstrBuilder.h
lib/CodeGen/MachineInstr.cpp
lib/CodeGen/RegAllocFast.cpp
test/DebugInfo/X86/dbg-declare-arg.ll