[all-commits] [llvm/llvm-project] 6e861d: [MachineCombiner] Preserve debug instruction number

Felipe de Azevedo Piovezan via All-commits all-commits at lists.llvm.org
Mon Mar 13 06:30:02 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6e861d818ae428dd8d2915ce37206a60533cd2d4
      https://github.com/llvm/llvm-project/commit/6e861d818ae428dd8d2915ce37206a60533cd2d4
  Author: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
  Date:   2023-03-13 (Mon, 13 Mar 2023)

  Changed paths:
    M llvm/lib/CodeGen/TargetInstrInfo.cpp
    A llvm/test/CodeGen/X86/machine-combiner-dbg.mir

  Log Message:
  -----------
  [MachineCombiner] Preserve debug instruction number

Each target's `TargetInstrInfo` is responsible for announcing which code
patterns it is able to transform during the MachineCombiner pass.
Currently, these patterns are applied without preserving the debug
instruction number required by the InstrRef implementation of
LiveDebugValues. As such, we've seen a number of examples where debug
information is dropped for variables in InstrRef mode that were
otherwise available in VarLoc mode. This has been observed both in X86
and AArch examples.

This commit is an initial attempt at preserving said numbers by changing
the general (target agnostic) implementation of TargetInstrInfo: the
reassociation pattern must keep the debug number of the "top level"
instruction, i.e., the instruction whose value represents the final
value of the arithmetic expression. Intermediate values must have their
debug number dropped, as they have no equivalent value in the
unoptimized code.

Future work is required to update each target's
`TargetInstrInfo::genAlternativeCodeSequence` method.

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




More information about the All-commits mailing list