[PATCH] D129909: [GlobalISel][DebugInfo] salvageDebugInfo analogue for gMIR

Vladislav Dzhidzhoev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 15:42:48 PDT 2022


dzhidzhoev created this revision.
dzhidzhoev added reviewers: jackoalan, arsenm, dsanders, aprantl, paquette, dblaikie.
Herald added subscribers: hiraditya, kristof.beyls, rovka.
Herald added a project: All.
dzhidzhoev requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

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 $noreg 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.

This commit increases the number of variables with 100% coverage of parent scope in llvm object files by 0.6%. Number of variables processed by location statistics has been increased by 0.6%.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129909

Files:
  llvm/include/llvm/CodeGen/GlobalISel/Utils.h
  llvm/lib/CodeGen/GlobalISel/Combiner.cpp
  llvm/lib/CodeGen/GlobalISel/Utils.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/salvage-debug-info-dead.mir
  llvm/test/CodeGen/AArch64/GlobalISel/uaddo-8-16-bits.mir
  llvm/test/DebugInfo/AArch64/debug-reg-bank.ll
  llvm/test/DebugInfo/X86/debug-reg-bank.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129909.445153.patch
Type: text/x-patch
Size: 16778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220715/2f679561/attachment-0001.bin>


More information about the llvm-commits mailing list