[llvm] [SPIRV] Addition of extension SPV_KHR_non_semantic_info and SPV_KHR_relaxed_extended_instruction (PR #169643)
Aadesh Premkumar via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 1 01:02:22 PST 2025
================
@@ -0,0 +1,46 @@
+; RUN: llc --verify-machineinstrs --spv-emit-nonsemantic-debug-info --spirv-ext=+SPV_KHR_non_semantic_info --print-after=spirv-nonsemantic-debug-info -O0 -mtriple=spirv64-unknown-unknown -stop-after=spirv-nonsemantic-debug-info %s -o - | FileCheck %s --check-prefix=CHECK-MIR
+; RUN: llc --verify-machineinstrs --spv-emit-nonsemantic-debug-info --spirv-ext=+SPV_KHR_non_semantic_info -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
+; RUN: llc --verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_KHR_non_semantic_info %s -o - | FileCheck %s --check-prefix=CHECK-OPTION
+; RUN: %if spirv-tools %{ llc --verify-machineinstrs --spv-emit-nonsemantic-debug-info --spirv-ext=+SPV_KHR_non_semantic_info -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
+
+; CHECK-MIR-DAG: [[type_void:%[0-9]+]]:type = OpTypeVoid
+; CHECK-MIR-DAG: OpExtInst [[type_void]], 3, 35
+; CHECK-MIR-DAG: OpExtInst [[type_void]], 3, 102
+; CHECK-MIR-DAG: OpExtInst [[type_void]], 3, 102
+
+; CHECK-SPIRV: %[[#ext_inst_non_semantic:]] = OpExtInstImport "NonSemantic.Shader.DebugInfo.100"
+
+; CHECK-SPIRV: %[[#void:]] = OpTypeVoid
+; CHECK-SPIRV: %[[#source:]] = OpExtInst %[[#void]] %[[#ext_inst_non_semantic]] DebugSource
+; CHECK-SPIRV: %[[#sourceCont1:]] = OpExtInst %[[#void]] %[[#ext_inst_non_semantic]] DebugSourceContinued
+; CHECK-SPIRV: %[[#sourceCont2:]] = OpExtInst %[[#void]] %[[#ext_inst_non_semantic]] DebugSourceContinued
+
+; CHECK-OPTION-NOT: OpExtInstImport "NonSemantic.Shader.DebugInfo.100"
+
+define spir_func void @test1() !dbg !9 {
+entry:
+ %a0 = alloca i32, align 4
+ #dbg_declare(ptr %a0, !17, !DIExpression(DW_OP_constu, 0, DW_OP_swap, DW_OP_xderef), !18)
+ store i32 1, ptr %a0, align 4, !dbg !18
+ ret void
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2, !3, !4, !5}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_Zig, file: !1, producer: "clang version XX.X.XXXX (FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
----------------
aadeshps-mcw wrote:
I used the same test file as the SPIRV-LLVM Translator.
It's basically more than the limit of characters allowed in DebugSource (262,131 characters) so that it exceeds it and generates DebugSourceContinued.
https://github.com/llvm/llvm-project/pull/169643
More information about the llvm-commits
mailing list