[PATCH] D66415: [DebugInfo at O2] Fix PR41992: LiveDebugVariables can drop DBG_VALUEs through misinterpreting fragments

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 05:44:47 PDT 2019


Orlando created this revision.
Orlando added reviewers: aprantl, probinson, vsk, dblaikie.
Orlando added a project: debug-info.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Bug: https://bugs.llvm.org/show_bug.cgi?id=41992

This patch prevents DBG_VALUE instructions being incorrectly coalesced by
liveDebugVariables.

A 'UserValue' roughly represents a source variable. A UserValue was identified
by looking at the source variable, DIExpression, and the inlined-at location
of the source variable.

This is a problem because this means arbitrary DIExpressions were being used
to classify the UserValues. For example, a DW_OP_deref on the value presented
in the DBG_VALUE doesn't change what source variable we're describing. Instead
we should only be looking at the fragment info in the DIExpression.

This patch identifies UserValues by looking at the source vaiable, the variable
fragment info, and the inlined-at location. UserValue no longer tracks the
DIExpression associated with the set of DBG_VALUES.

DbgValueLocation seemed like a good place to keep track of the DIExpression
used by the DBG_VALUE because:

1. This stops the locations with different DIExpressions being coalesced by the interval map used to track the uses.
2. There is a 1-to-1 mapping of use locations to DIExpressions.
3. Minimal source changes required to implement this fix.

I've added a test which covers the case outlined in the bug.


Repository:
  rL LLVM

https://reviews.llvm.org/D66415

Files:
  llvm/lib/CodeGen/LiveDebugVariables.cpp
  llvm/test/DebugInfo/pr41992.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66415.215862.patch
Type: text/x-patch
Size: 11641 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190819/50a394f3/attachment.bin>


More information about the llvm-commits mailing list