[all-commits] [llvm/llvm-project] 2b2ffb: [DebugInfo][InstrRef][3/4] Produce DBG_INSTR_REFs ...

Jeremy Morse via All-commits all-commits at lists.llvm.org
Tue Jul 6 10:41:50 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2b2ffb7bdc21bce33372fdd02571b94c2a5e774a
      https://github.com/llvm/llvm-project/commit/2b2ffb7bdc21bce33372fdd02571b94c2a5e774a
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2021-07-06 (Tue, 06 Jul 2021)

  Changed paths:
    M llvm/include/llvm/CodeGen/MachineFunction.h
    M llvm/lib/CodeGen/MachineFunction.cpp
    M llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
    M llvm/lib/CodeGen/SelectionDAG/InstrEmitter.h
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
    M llvm/test/DebugInfo/X86/arg-dbg-value-list.ll
    M llvm/test/DebugInfo/X86/dbg-val-list-undef.ll
    M llvm/test/DebugInfo/X86/instr-ref-selectiondag.ll
    M llvm/test/DebugInfo/X86/invalidated-dbg-value-is-undef.ll

  Log Message:
  -----------
  [DebugInfo][InstrRef][3/4] Produce DBG_INSTR_REFs for all variable locations

This patch emits DBG_INSTR_REFs for two remaining flavours of variable
locations that weren't supported: copies, and inter-block VRegs. There are
still some locations that must be represented by DBG_VALUE such as
constants, but they're mostly independent of optimisations.

For variable locations that refer to values defined in different blocks,
vregs are allocated before isel begins, but the defining instruction
might not exist until late in isel. To get around this, emit
DBG_INSTR_REFs in a "half done" state, where the first operand refers to a
VReg. Then at the end of isel, patch these back up to refer to
instructions, using the finalizeDebugInstrRefs method.

Copies are something that I complained about the original RFC, and I
really don't want to have to put instruction numbers on copies. They don't
define a value: they move them. To address this isel, salvageCopySSA
interprets:
 * COPYs,
 * SUBREG_TO_REG,
 * Anything that isCopyInstr thinks is a copy.
And follows chains of copies back to the defining instruction that they
read from. This relies on any physical registers that COPYs read being
defined in the same block, or being entry-block arguments. For the former
we can put an instruction number on the defining instruction; for the
latter we can drop a DBG_PHI that reads the incoming value.

Differential Revision: https://reviews.llvm.org/D88896




More information about the All-commits mailing list