[clang] [Hlsl][Spirv] Don't emit global variables for structs containing resources (PR #234797)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 8 20:16:10 PST 2026
================
@@ -0,0 +1,24 @@
+// When processing a struct containing resources, we should split members recursively into
+// their own global variables, and not emit a global of struct or array of
+// struct type which contains a resource
+
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --implicit-check-not='@g =' --implicit-check-not='@array ='
+// RUN: %clang_cc1 -triple spirv1.6-unknown-vulkan1.3-compute -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --implicit-check-not='@g =' --implicit-check-not='@array ='
+// RUN: %if spirv-registered-target && spirv-val %{ %clang_cc1 -triple spirv1.6-unknown-vulkan1.3-compute -O3 -emit-obj -o %t.spv %s && spirv-val --target-env vulkan1.3 %t.spv %}
+
+// CHECK: @_ZL5g.Buf = internal global
+// CHECK: @_ZL11array.0.Buf = internal global
+// CHECK: @_ZL11array.1.Buf = internal global
----------------
rj123-nv wrote:
It used implicit checks in the RUN arguments. I changed it to use CHECK-NOT's but I think I need them in between the positive checks if I don't want to make assumptions of where they'd get put
https://github.com/llvm/llvm-project/pull/234797
More information about the cfe-commits
mailing list