[PATCH] D37929: [DebugInfo] Add missing DW_OP_deref when an NRVO pointer is spilled

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 13:44:37 PDT 2017


rnk created this revision.
Herald added subscribers: hiraditya, qcolombet, MatzeB.

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.


https://reviews.llvm.org/D37929

Files:
  llvm/include/llvm/CodeGen/MachineInstrBuilder.h
  llvm/lib/CodeGen/MachineInstr.cpp
  llvm/lib/CodeGen/RegAllocFast.cpp
  llvm/test/DebugInfo/X86/dbg-declare-arg.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37929.115480.patch
Type: text/x-patch
Size: 7727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170915/4fccf116/attachment.bin>


More information about the llvm-commits mailing list