[all-commits] [llvm/llvm-project] 7e1eaf: [DebugInfo] Support global addresses in variable l...
Adrian Prantl via All-commits
all-commits at lists.llvm.org
Thu Oct 1 15:18:55 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7e1eafc57669a23bc7d60afa14c90c9799ae7082
https://github.com/llvm/llvm-project/commit/7e1eafc57669a23bc7d60afa14c90c9799ae7082
Author: Adrian Prantl <aprantl at apple.com>
Date: 2026-10-01 (Thu, 01 Oct 2026)
Changed paths:
M llvm/include/llvm/CodeGen/Analysis.h
M llvm/lib/CodeGen/Analysis.cpp
M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
M llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h
M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
M llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
M llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
M llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
M llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
M llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
M llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
M llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
M llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
M llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
M llvm/test/CodeGen/AArch64/GlobalISel/debug-insts.ll
A llvm/test/DebugInfo/AArch64/dbg-value-globaladdr-gisel.ll
A llvm/test/DebugInfo/ARM/dbg-value-globaladdr-rwpi.ll
A llvm/test/DebugInfo/COFF/globaladdr-codeview.ll
A llvm/test/DebugInfo/MIR/X86/globaladdr-mixed-locations.mir
A llvm/test/DebugInfo/MIR/X86/globaladdr-offset.mir
A llvm/test/DebugInfo/WebAssembly/dbg-value-globaladdr-pic.ll
A llvm/test/DebugInfo/X86/dbg-value-globaladdr-rejected.ll
A llvm/test/DebugInfo/X86/dbg-value-globaladdr.ll
A llvm/test/DebugInfo/X86/globaladdr-offset.ll
A llvm/test/DebugInfo/X86/globaladdr-tag-offset.ll
A llvm/test/DebugInfo/X86/got-equivalent.ll
A llvm/test/DebugInfo/X86/implicit-pointer-global.ll
M llvm/test/DebugInfo/X86/sdag-dangling-dbgvalue.ll
A llvm/test/DebugInfo/X86/variadic-global.ll
M llvm/test/DebugInfo/assignment-tracking/X86/sdag-dangling-dbgassign.ll
Log Message:
-----------
[DebugInfo] Support global addresses in variable locations (#218722)
This patch adds support for global address locations to SelectionDAG,
GlobalISel and AsmPrinter. The actual implementation is very similar to
how constants are being handled so most code changes are very
mechanical.
The motivation for adding global address support is the Swift compiler
and it is needed even in unoptimized code. For example, the standard
libary implements the empty array with a global "empty array storage"
singleton object, so it can show up as the location of array values.
Another very common use-case are references to type metadata, which is
also accessed via global symbols.
It is even possible to motivate this with a C exmple:
extern int g; int *p = &g;
also produces the dbg_value with a global value.
This patch adds an SDDbgOperand kind for a global address which gets
lowered to a MO_GlobalAddress DBG_VALUE operand, a DbgValueLocEntry, and
finally DW_OP_addrx/DW_OP_stack_value, similar to how global
DITemplateValueParameter are handled.
In AsmPrinter the address pool is preferred, its index is plain data
that both a DIE and the byte stream backing a location list can hold.
Before DWARF 5 the pool is only available under split DWARF, so fall
back to a relocated DW_OP_addr, which only a DIE can carry. Emit no
location at all when neither is possible.
Not handled are thread locals, which need DW_OP_form_tls_address,
dllimport, whose address requires a load from the import address table,
and ifuncs, whose symbol address is not the value of the pointer.
rdar://156549577
Assisted-by: Claude
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list