[all-commits] [llvm/llvm-project] 671b21: [SPIRV] Emit NonSemantic DebugDeclare, DebugExpres...

Manuel Carrasco via All-commits all-commits at lists.llvm.org
Fri Sep 11 06:20:41 PDT 2026


  Branch: refs/heads/users/mgcarrasco/nsdi-debug-declare-new
  Home:   https://github.com/llvm/llvm-project
  Commit: 671b21791a9b65da44d1263ee289c95c4898ff31
      https://github.com/llvm/llvm-project/commit/671b21791a9b65da44d1263ee289c95c4898ff31
  Author: Manuel Carrasco <Manuel.Carrasco at amd.com>
  Date:   2026-09-11 (Fri, 11 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

  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.


  Commit: 871b9e3ca95faf7f84510de4c3ee2554f55544e7
      https://github.com/llvm/llvm-project/commit/871b9e3ca95faf7f84510de4c3ee2554f55544e7
  Author: Manuel Carrasco <Manuel.Carrasco at amd.com>
  Date:   2026-09-11 (Fri, 11 Sep 2026)

  Changed paths:
    M llvm/test/CodeGen/SPIRV/debug-info/debug-declare-module-scope-variable.ll

  Log Message:
  -----------
  Fix linter.


  Commit: 8191abeba258df471a36ec73488b6f3f23dff897
      https://github.com/llvm/llvm-project/commit/8191abeba258df471a36ec73488b6f3f23dff897
  Author: Manuel Carrasco <Manuel.Carrasco at amd.com>
  Date:   2026-09-11 (Fri, 11 Sep 2026)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp

  Log Message:
  -----------
  [reviews] fix typos.


  Commit: f0963adbc700f264d276e16b0cc37338514b6f17
      https://github.com/llvm/llvm-project/commit/f0963adbc700f264d276e16b0cc37338514b6f17
  Author: Manuel Carrasco <Manuel.Carrasco at amd.com>
  Date:   2026-09-11 (Fri, 11 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-expression-operation-cache.ll

  Log Message:
  -----------
  Cache DebugOperation.


  Commit: 1056e1cb9d4a2f0634c8258ff04ca0408dd0d335
      https://github.com/llvm/llvm-project/commit/1056e1cb9d4a2f0634c8258ff04ca0408dd0d335
  Author: Manuel Carrasco <Manuel.Carrasco at amd.com>
  Date:   2026-09-11 (Fri, 11 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-expression-cache.ll

  Log Message:
  -----------
  Implement caching for DebugExpression.


  Commit: ce4e1221c85bd6b175b43aa793fae622ba4d2d6c
      https://github.com/llvm/llvm-project/commit/ce4e1221c85bd6b175b43aa793fae622ba4d2d6c
  Author: Manuel Carrasco <Manuel.Carrasco at amd.com>
  Date:   2026-09-11 (Fri, 11 Sep 2026)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp
    M llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.h

  Log Message:
  -----------
  [reviews] Simplify code.


  Commit: e51b92de9871b3276afad198d4b82fe91f6b1a44
      https://github.com/llvm/llvm-project/commit/e51b92de9871b3276afad198d4b82fe91f6b1a44
  Author: Manuel Carrasco <Manuel.Carrasco at amd.com>
  Date:   2026-09-11 (Fri, 11 Sep 2026)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp

  Log Message:
  -----------
  [review] Use enum.


Compare: https://github.com/llvm/llvm-project/compare/2e1bf3a39cab...e51b92de9871

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