[PATCH] D49454: [DebugInfo] LowerDbgDeclare: Add derefs when handling CallInst users

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 17 14:15:08 PDT 2018


vsk created this revision.
vsk added reviewers: rnk, aprantl, bjope.
vsk added a project: debug-info.
Herald added a subscriber: JDevlieghere.

LowerDbgDeclare inserts a dbg.value before each use of an address
described by a dbg.declare. When inserting a dbg.value before a CallInst
use, however, it fails to append DW_OP_deref to the DIExpression.

The DW_OP_deref is needed to reflect the fact that a dbg.value describes
a source variable directly (as opposed to a dbg.declare, which relies on
pointer indirection).

This patch adds in the DW_OP_deref where needed. This results in the
correct values being shown during a debug session for a program compiled
with ASan and optimizations.

Note that ConvertDebugDeclareToDebugValue is already correct -- no
changes there are needed.

Testing:

- check-llvm, and an end-to-end test using lldb to debug an optimized program.
- Existing unit tests for DIExpression::appendToStack fully cover the new DIExpression::append utility.


https://reviews.llvm.org/D49454

Files:
  include/llvm/IR/DebugInfoMetadata.h
  lib/IR/DebugInfoMetadata.cpp
  lib/Transforms/Utils/Local.cpp
  test/Transforms/InstCombine/lower-dbg-declare.ll
  unittests/IR/MetadataTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49454.155970.patch
Type: text/x-patch
Size: 17012 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180717/f47d037c/attachment.bin>


More information about the llvm-commits mailing list