[clang] [llvm] [SPIR-V] Fixup storage class for global private (PR #116636)

Steven Perron via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 06:27:26 PST 2024


Nathan =?utf-8?q?Gauër?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/116636 at github.com>


================
@@ -0,0 +1,17 @@
+; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
+
+ at PrivInternal = internal addrspace(10) global i32 456
+; CHECK-DAG:  %[[#type:]] = OpTypeInt 32 0
+; CHECK-DAG: %[[#ptrty:]] = OpTypePointer Private %[[#type]]
+; CHECK-DAG: %[[#value:]] = OpConstant %[[#type]] 456
+; CHECK-DAG:   %[[#var:]] = OpVariable %[[#ptrty]] Private %[[#value]]
+
+define spir_kernel void @Foo() {
+  %p = addrspacecast ptr addrspace(10) @PrivInternal to ptr
----------------
s-perron wrote:

Okay, we can leave this for now. I'll want to see how this code pattern is generated by clang/llvm because I fear it could lead to invalid spir-v, but we can deal with that when we start using the address space in clang.

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


More information about the cfe-commits mailing list