[PATCH] D66942: [DebugInfo] LiveDebugValues: locations with different exprs should compare differently

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 06:57:21 PDT 2019


jmorse created this revision.
jmorse added reviewers: aprantl, vsk, wolfgangp.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In the attached C test case, when joining variable locations from two parent blocks, the "baz" variable in one parent is located in a register with an empty DIExpression, in the other block it's located in the same register but with a complex expression. LiveDebugValues wrongly decides that this is the same location, and propagates one of the locations for "baz" to the exit block. The correct behaviour would be to propagate no location: the value of "baz" depends on the path taken through the program, and isn't stored in a register or stack slot.

Happily this is a simple as adding a DIExpression field to the "VarLoc" class (which identifies a machine location), and having VarLocs compare unequal if their DIExpressions are different. This relies on the DIExpressions being uniq'd, which I believe metadata guarantees.

On a clang-3.4 build this results in no variable losing all their locations, and a fall in 0.6% scope-bytes-covered. Which is great, because those are probably invalid locations.


Repository:
  rL LLVM

https://reviews.llvm.org/D66942

Files:
  lib/CodeGen/LiveDebugValues.cpp
  test/DebugInfo/X86/live-debug-values-expr-conflict.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66942.217864.patch
Type: text/x-patch
Size: 5405 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190829/44915b9f/attachment.bin>


More information about the llvm-commits mailing list