[PATCH] D37768: [IR] Add llvm.dbg.addr, a control-dependent version of llvm.dbg.declare

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 13:48:33 PDT 2017


rnk created this revision.
Herald added subscribers: hiraditya, eraman.

This implements the design discussed on llvm-dev for better tracking of
variables that live in memory through optimizations:

  http://lists.llvm.org/pipermail/llvm-dev/2017-September/117222.html

This is tracked as PR34136

llvm.dbg.addr is intended to be produced and used in almost precisely
the same way as llvm.dbg.declare is today, with the exception that it is
control-dependent. That means that dbg.addr should always have a
position in the instruction stream, and it will allow passes that
optimize memory operations on local variables to insert llvm.dbg.value
calls to reflect deleted stores. See SourceLevelDebugging.rst for more
details.

The main drawback to generating DBG_VALUE machine instrs is that they
usually cause LLVM to emit a location list for DW_AT_location. The next
step will be to teach DwarfDebug.cpp how to recognize more DBG_VALUE
ranges as not needing a location list, and possibly start setting
DW_AT_start_offset for variables whose lifetimes begin mid-scope.


https://reviews.llvm.org/D37768

Files:
  llvm/docs/SourceLevelDebugging.rst
  llvm/include/llvm/IR/IntrinsicInst.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/include/llvm/Transforms/Utils/Local.h
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/IR/DIBuilder.cpp
  llvm/lib/IR/IntrinsicInst.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
  llvm/test/DebugInfo/X86/dbg-addr-dse.ll
  llvm/test/DebugInfo/X86/dbg-addr.ll
  llvm/test/Transforms/Mem2Reg/dbg-addr-inline-dse.ll
  llvm/test/Transforms/Mem2Reg/dbg-addr.ll
  llvm/test/Transforms/SROA/dbg-addr-diamond.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37768.114904.patch
Type: text/x-patch
Size: 50887 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170912/174b96c2/attachment.bin>


More information about the llvm-commits mailing list