[PATCH] D105430: [DebugInfo][InstrRef] Use target hook to recognise all stack spills

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 5 05:14:42 PDT 2021


jmorse created this revision.
jmorse added a reviewer: debug-info.
Herald added subscribers: pengfei, hiraditya, qcolombet.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Sometimes LLVM will generate code where values are both kept in a register temporarily, and spilt to the stack too. See the MIR in the attached test case, for example: r10 is loaded in the entry block, used in block three, and later restored in block eight. Variable location tracking couldn't deal with this because:

- We couldn't always determine the stored register from spilled instructions,
- VarLoc based LiveDebugValues could only track one location at a time for each variable.

D105428 <https://reviews.llvm.org/D105428> (fixing a target hook for recognising stores) and InstrRef based LiveDebugValues fix these things respectively. We can now follow values in registers and on the stack at the same time. This means, for the attached test case, we can find a variable location on the stack at the position of the DBG_INSTR_REF, and emit corresponding DBG_VALUEs.

This patch deletes the old way of recognising store instruction registers, by looking for a kill flag on a register. Instead, rely fully on the target hook, `isStoreToStackSlotPostFE`, which returns the store-source register. This code was already in-tree, but hidden behind a flag, which this patch deletes.

Net X86 PC coverage gains with instruction referencing on a stage 2 clang build is 3%, which is... nice. (This forms part of what I've already reported on the mailing list).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105430

Files:
  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
  llvm/test/DebugInfo/MIR/InstrRef/follow-spill-of-live-value.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105430.356480.patch
Type: text/x-patch
Size: 24171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210705/28afaae2/attachment.bin>


More information about the llvm-commits mailing list