[llvm] [DebugInfo] Support global addresses in variable locations (PR #218722)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 11:00:35 PDT 2026


dwblaikie wrote:

Can you say a bit more about the motivating examples?
Taking:
```
extern int g; int *p = &g;
```
At `-O0`, this can be described with Clang/LLVM today ( https://godbolt.org/z/cKqMcT3sd - `DW_AT_location	(DW_OP_fbreg -8)`). At `-O1` without a use, it'll be optimized away entirely, though, yes, the value could be described (I guess that's the bug/missing feature you're looking to implement?)
(at `-O1` with a use, it seems we still get a location for a limited range: https://godbolt.org/z/6oW68fej4 ` DW_AT_location	(indexed (0x0) loclist = 0x00000010: [0x0000000000000007, 0x000000000000000d): DW_OP_reg0 RAX)`)

https://github.com/llvm/llvm-project/pull/218722


More information about the llvm-commits mailing list