llvm-project/llvm
Vladislav Dzhidzhoev facb3ac385 [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
2022-08-01 11:14:53 +02:00
..
benchmarks
bindings [IR] Remove support for float binop constant expressions 2022-07-12 09:40:49 +02:00
cmake [cmake] Support native LoongArch builds 2022-08-01 15:10:24 +08:00
docs [NFC] Fill up the title underline in rst file 2022-08-01 11:07:19 +08:00
examples [Examples] Fix SimplifyCFG example 2022-08-01 07:22:35 +02:00
include [GlobalISel][DebugInfo] salvageDebugInfo analogue for gMIR 2022-08-01 11:14:53 +02:00
lib [GlobalISel][DebugInfo] salvageDebugInfo analogue for gMIR 2022-08-01 11:14:53 +02:00
projects
resources
runtimes
test [GlobalISel][DebugInfo] salvageDebugInfo analogue for gMIR 2022-08-01 11:14:53 +02:00
tools Use any_of (NFC) 2022-07-30 10:35:56 -07:00
unittests [AA] Do not track Must in ModRefInfo 2022-08-01 07:14:31 +02:00
utils [gn build] Port 88181375a3 more 2022-07-30 19:30:53 -04:00
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt Bump the trunk major version to 16 2022-07-26 21:34:45 -07:00
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in

README.txt

The LLVM Compiler Infrastructure
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.