[llvm] [SPIR-V] Deduce pointee type for all global variables, not only initialized ones (PR #202047)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 11 06:42:27 PDT 2026
================
@@ -0,0 +1,37 @@
+; A global variable's pointee type is concrete (its value type) and must be used
+; even for an undef-initialized, NON-constant aggregate — e.g. a Workgroup
+; `[N x T]` shared tile. Otherwise the variable's type is inferred from a flat
+; element-typed GEP use as the scalar element, the array-to-pointer-decay rewrite
+; is skipped, and under Logical SPIR-V the dynamic index is dropped (every
+; invocation accesses element 0). The variable must keep its array type and be
+; indexed with an OpAccessChain carrying the dynamic index.
+
+; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-vulkan1.3-compute %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan1.3-compute %s -o - -filetype=obj | spirv-val %}
----------------
MrSidims wrote:
Lets also add:
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
https://github.com/llvm/llvm-project/pull/202047
More information about the llvm-commits
mailing list