[PATCH] D105428: [X86] Correctly return src/dest register from stack spill/restore recogniser hooks

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 5 09:41:26 PDT 2021


jmorse updated this revision to Diff 356516.
jmorse added a subscriber: debug-info.
jmorse added a comment.
Herald added a subscriber: qcolombet.

Squashing the child commit into this so that the relevant test lands at the same time -- original review message for D105430 <https://reviews.llvm.org/D105430> follows. The X86 backend part of this change allows us to identify the source register as r10 in the following:

  MOV64mr $rsp, 1, $noreg, -8, $noreg, renamable $r10 :: (store 8 into %stack.0)

Which subsequently allows us to know that the value loaded into r10 earlier can be found in %stack.0.

~

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.

This patches fix of the target hooks 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).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105428/new/

https://reviews.llvm.org/D105428

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105428.356516.patch
Type: text/x-patch
Size: 24860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210705/7b0a7e0f/attachment.bin>


More information about the llvm-commits mailing list