[PATCH] D57271: [DebugInfo] Handle restore instructions in LiveDebugValues

Wolfgang Pieb via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 25 17:17:59 PST 2019


wolfgangp created this revision.
wolfgangp added reviewers: aprantl, NikolaPrica, probinson, vsk.

We recognize spill instructions in LiveDebugValues, i.e. we create DBG_VALUE instructions for variables that are spilled with the appropriate spill locations. We do not, however, recognize the corresponding restore instructions, which can cause large gaps in location information. For example: given a basic block BB with 2 or more predecessors, a variable is live in a register at the exit of the first predecessor, but has been spilled in one or more of the other predecessors. The compiler of course restores the variable at the end of those predecessors, but at present we fail to recognize this. Consequently we fail to provide location information (i.e. we don't generate DBG_VALUE instructions) for the variable in BB because of seemingly conflicting locations.

This patch attempts to rectify this by recognizing restore instructions and folding them into the existing concept of 'transfers', similar to how copies are handled (see https://reviews.llvm.org/D44016).

In essence the patch consists of the following changes:

1. Enhancing the VarLoc structure to keep track of spill locations.
2. Introducing recognition of restore instructions analogous to recognition of spill instructions.
3. Refactoring 'insertTransferDebugPair()' to distinguish between copies, spills and restores. This causes new DBG_VALUE instructions to be generated in response to restores.

I haven't collected any data yet on improvements to location coverage, but will do so shortly.


https://reviews.llvm.org/D57271

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57271.183653.patch
Type: text/x-patch
Size: 22795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190126/8b0e94ea/attachment.bin>


More information about the llvm-commits mailing list