[PATCH] D66412: [DebugInfo][LiveDebugValues] Don't drop variable location tracking data across block boundaries

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 04:44:34 PDT 2019


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

LiveDebugValues propagates variable locations between blocks by creating new DBG_VALUE insts in the successors, then interpreting them when it passes back through the block at a later time. However, this flushes out any extra information about the location that LiveDebugValues holds: for example, connections between variable locations such as discussed in D65368 <https://reviews.llvm.org/D65368>. And as reported in PR42772 [0] this causes us to lose track of the fact that a spill-location is actually a spill, not a register location.

This patch fixes that by deferring the creation of propagated DBG_VALUEs until after propagation has completed: instead location propagation occurs only by sharing location ID numbers between blocks. As a bonus, this reduces a large amount of un-necessary extra DBG_VALUE interpretation, a clang3.4 w/asan build is 1.6% faster for me.

Details:

- A collection of "pending" propagated-locations is maintained, and loaded into the OpenRanges object before propagation begins. This replicates the re-interpretation of propagated locations behaviour,
- flushPendingLocs creates DBG_VALUEs from the "pending" collection, but only at the end of the pass,
- "transferTerminator" must now be explicitly called per block, as a block may have neither terminator nor DBG_VALUE insts,
- I've added a file-comment explaining how LiveDebugValues records locations, as it's relatively undocumented right now.

The added test function has a stack-spill in bb.1, which is restored in the exit block bb.3. Current LLVM doesn't recognise the restore because it's lost the fact that the variable location is a spill across the blocks. With this patch, it does recognise it.

[0] https://bugs.llvm.org/show_bug.cgi?id=42772


Repository:
  rL LLVM

https://reviews.llvm.org/D66412

Files:
  lib/CodeGen/LiveDebugValues.cpp
  test/DebugInfo/MIR/X86/live-debug-values-restore.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66412.215857.patch
Type: text/x-patch
Size: 22194 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190819/01af6a5b/attachment.bin>


More information about the llvm-commits mailing list