This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][InstrRef] Use target hook to recognise all stack spills
AbandonedPublic

Authored by jmorse on Jul 5 2021, 5:14 AM.

Details

Reviewers
None
Group Reviewers
debug-info
Summary

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 (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).

Diff Detail

Event Timeline

jmorse created this revision.Jul 5 2021, 5:14 AM
jmorse requested review of this revision.Jul 5 2021, 5:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2021, 5:14 AM
jmorse abandoned this revision.Jul 5 2021, 9:41 AM

Folded this revision into D105428, that way at least the relevant tests land at the same time.