[all-commits] [llvm/llvm-project] a9e053: [SPIRV] Emit NonSemantic DebugDeclare, DebugExpres...
Manuel Carrasco via All-commits
all-commits at lists.llvm.org
Tue Sep 8 07:15:09 PDT 2026
Branch: refs/heads/users/mgcarrasco/nsdi-debug-declare
Home: https://github.com/llvm/llvm-project
Commit: a9e05349caf7b93bb6cdc2047e3388cabc03af33
https://github.com/llvm/llvm-project/commit/a9e05349caf7b93bb6cdc2047e3388cabc03af33
Author: Manuel Carrasco <Manuel.Carrasco at amd.com>
Date: 2026-09-08 (Tue, 08 Sep 2026)
Changed paths:
M llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp
M llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.h
A llvm/test/CodeGen/SPIRV/debug-info/debug-declare-access-chain.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-declare-dbg-value-variadic.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-declare-dead-alloca.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-declare-expression-unsupported.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-declare-expression-xderef.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-declare-function-parameter.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-declare-int-storage.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-declare-line-scope.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-declare-module-scope-variable.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-declare-null-storage.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-declare-poison-storage.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-declare-skip-type.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-declare.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-expression-bit-piece.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-expression-operations.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-expression-out-of-range.ll
A llvm/test/CodeGen/SPIRV/debug-info/debug-global-variable-constant-value.ll
M llvm/test/CodeGen/SPIRV/debug-info/debug-global-variable-init-expr.ll
M llvm/test/CodeGen/SPIRV/debug-info/debug-local-variable-dbg-value.ll
M llvm/test/CodeGen/SPIRV/debug-info/debug-local-variable-records-and-retained.ll
Log Message:
-----------
[SPIRV] Emit NonSemantic DebugDeclare, DebugExpression and DebugOperation.
Add support for
[DebugDeclare](https://github.khronos.org/SPIRV-Registry/nonsemantic/NonSemantic.Shader.DebugInfo.html#DebugDeclare),
[DebugExpression](https://github.khronos.org/SPIRV-Registry/nonsemantic/NonSemantic.Shader.DebugInfo.html#DebugExpression)
and
[DebugOperation](https://github.khronos.org/SPIRV-Registry/nonsemantic/NonSemantic.Shader.DebugInfo.html#DebugOperation).
Changes:
- Emit DebugDeclare from an indirect DBG_VALUE whose location register is
defined by OpVariable, which is what the spec requires of the Variable
operand. #dbg_declare does not survive as its own opcode in MIR, IRTranslator
lowers it to an indirect DBG_VALUE.
- Skip every other shape instead of emitting an invalid instruction: an access
chain into a field, an OpFunctionParameter for a byval argument, a constant
address, a register left without a def after dead storage was erased, a
variadic #dbg_value, an expression using an unmapped operation, and a variable
whose DebugLocalVariable was not emitted.
- Collect expressions from MIR, so DebugExpression and DebugOperation are
emitted at module scope and shared by every declare using the same
DIExpression.
- Map the nine operations the instruction set defines, and reject an
expression whole when an argument does not fit in 32 bits (as per spec).
- Cache DebugLocalVariable result ids, which emitDebugLocalVariable already
returned but nothing stored.
- Add tests for each emitted and skipped case, for the interaction with
DebugLine and DebugScope, and for the expression operations.
spirv-val and the spec disagree in two places, in opposite directions:
- DebugDeclare's Variable operand: spirv-val accepts an OpFunctionParameter,
while the spec names only OpVariable. This patch follows the spec, so the byval
case is skipped even though spirv-val would take it, see
debug-declare-function-parameter.ll.
- DebugGlobalVariable's Variable operand: spirv-val rejects a DebugExpression
there although the spec permits one, KhronosGroup/SPIRV-Tools#6469, see debug-global-variable-constant-value.ll.
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