[all-commits] [llvm/llvm-project] facb3a: [GlobalISel][DebugInfo] salvageDebugInfo analogue ...

chbessonova via All-commits all-commits at lists.llvm.org
Mon Aug 1 02:15:31 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: facb3ac385c3c5fc6775ea320ed2fcfeb2f595f6
      https://github.com/llvm/llvm-project/commit/facb3ac385c3c5fc6775ea320ed2fcfeb2f595f6
  Author: Vladislav Dzhidzhoev <vdzhidzhoev at accesssoftek.com>
  Date:   2022-08-01 (Mon, 01 Aug 2022)

  Changed paths:
    M llvm/include/llvm/CodeGen/CodeGenCommonISel.h
    M llvm/include/llvm/CodeGen/GlobalISel/Utils.h
    M llvm/lib/CodeGen/CodeGenCommonISel.cpp
    M llvm/lib/CodeGen/GlobalISel/Combiner.cpp
    M llvm/lib/CodeGen/GlobalISel/Utils.cpp
    A llvm/test/CodeGen/AArch64/GlobalISel/salvage-debug-info-dead.mir
    M llvm/test/DebugInfo/AArch64/debug-reg-bank.ll
    M llvm/test/DebugInfo/X86/debug-reg-bank.ll

  Log Message:
  -----------
  [GlobalISel][DebugInfo] salvageDebugInfo analogue for gMIR

Salvage debug info of instruction that is about to be deleted as dead in
Combiner pass. Currently supported instructions are COPY and G_TRUNC.

It allows to salvage debug info of some dead arguments of functions, by putting
DWARF expression corresponding to the instruction being deleted into related
DBG_VALUE instruction.

Here is an example of missing variables location https://godbolt.org/z/K48osb9dK.
We see that arguments x, y of function foo are not available in debugger, and
corresponding DBG_VALUE instructions have undefined register operand instead of
variables locaton after Aarch64PreLegalizerCombiner pass. The reason is that
registers where variables are located are removed as dead (with instruction
G_TRUNC). We can use salvageDebugInfo analogue for gMIR to preserve debug
locations of dead variables.

Statistics of llvm object files built with vs without this commit on -O2
optimization level (CMAKE_BUILD_TYPE=RelWithDebInfo, -fglobal-isel) on Aarch64 (macOS):

Number of variables with 100% of parent scope covered by DW_AT_location has been increased by 7,9%.
Number of variables with 0% coverage of parent scope has been decreased by 1,2%.
Number of variables processed by location statistics has been increased by 2,9%.
Average PC ranges coverage has been increased by 1,8 percentage points.

Coverage can be improved by supporting more instructions, or by calling
salvageDebugInfo for instructions that are deleted during Combiner rules exection.

Reviewed By: aprantl

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




More information about the All-commits mailing list