[all-commits] [llvm/llvm-project] 79a1e3: [GlobalISel] Improve stack slot tracking in dbg.va...
Felipe de Azevedo Piovezan via All-commits
all-commits at lists.llvm.org
Wed Apr 5 05:21:24 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 79a1e32915631469b4ea50c0e00ccd7ecc828d00
https://github.com/llvm/llvm-project/commit/79a1e32915631469b4ea50c0e00ccd7ecc828d00
Author: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
Date: 2023-04-05 (Wed, 05 Apr 2023)
Changed paths:
M llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
M llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
M llvm/test/CodeGen/AArch64/GlobalISel/debug-insts.ll
Log Message:
-----------
[GlobalISel] Improve stack slot tracking in dbg.values
For IR like:
```
%alloca = alloca ...
dbg.value(%alloca, !myvar, OP_deref(<other_ops>))
```
GlobalISel lowers it to MIR:
```
%some_reg = G_FRAME_INDEX <stack_slot>
DBG_VALUE %some_reg, !myvar, OP_deref(<other_ops>)
```
In other words, if the value of `!myvar` can be obtained by
dereferencing an alloca, in MIR we say that the _location_ of a variable
is obtained by dereferencing register %some_reg (plus some
`<other_ops>`).
We can instead remove the use of `%some_reg`: the location of `!myvar`
_is_ `<stack_slot>` (plus some `<other_ops>`). This patch implements
this transformation, which improves debug information handling in O0, as
these registers hardly ever survive register allocation.
A note about testing: similar to what was done in D76934
(f24e2e9eebde4b7a1d), this patch exposed a bug in the Builder class when
using `-debug`, where we tried to print an incomplete instruction. The
changes in `MachineIRBuilder.cpp` address that.
Differential Revision: https://reviews.llvm.org/D147536
More information about the All-commits
mailing list