[llvm] [SPIR-V] Emit DebugTypeBasic for NonSemantic DI (PR #106980)

Vyacheslav Levytskyy via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 07:01:04 PDT 2024


================
@@ -0,0 +1,232 @@
+; 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 %s -o - 2>&1 | 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: [[type_i32:%[0-9]+\:type]] = OpTypeInt 32, 0
+; CHECK-MIR: [[encoding_signedchar:%[0-9]+\:iid\(s32\)]] = OpConstantI [[type_i32]], 5
----------------
VyacheslavLevytskyy wrote:

"All type declarations (OpTypeXXX instructions), all constant instructions, and all global variable declarations ... All operands in all these instructions must be declared before being used. Otherwise, they can be in any order."

I would interpret this so that we may not require "CHECK-SPIRV: [[encoding_signedchar:%[0-9]+]] = OpConstant [[type_int32]] 5" to be after any of OpTypeXXX instructions.

Another good example is "; CHECK-SPIRV: [[str_double:%[0-9]+]] = OpString "double" where, in my opinion, it's much better to ignore the requirement for OpString to be before OpTypeXXX than to rely on "; CHECK-SPIRV: [[str_double:%[0-9]+]] = OpString "double" to be the last of all OpString instructions.

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


More information about the llvm-commits mailing list