88
99; CHECK-DAG: OpDecorate [[Var:%[0-9]+]] DescriptorSet 3
1010; CHECK-DAG: OpDecorate [[Var]] Binding 4
11+ ; CHECK-DAG: OpDecorate [[OtherVar:%[0-9]+]] DescriptorSet 3
12+ ; CHECK-DAG: OpDecorate [[OtherVar]] Binding 4
1113
1214; CHECK-DAG: [[int:%[0-9]+]] = OpTypeInt 32 0
1315; CHECK-DAG: [[BufferType:%[0-9]+]] = OpTypeImage [[int]] 1D 2 0 0 1 R32i {{$}}
1921; CHECK-DAG: [[ArrayPtrType:%[0-9]+]] = OpTypePointer UniformConstant [[BufferArrayType]]
2022; CHECK-DAG: [[Var]] = OpVariable [[ArrayPtrType]] UniformConstant
2123
24+ ; CHECK-DAG: [[OtherArraySize:%[0-9]+]] = OpConstant [[int]] 5
25+ ; CHECK-DAG: [[OtherBufferArrayType:%[0-9]+]] = OpTypeArray [[BufferType]] [[OtherArraySize]]
26+ ; CHECK-DAG: [[OtherArrayPtrType:%[0-9]+]] = OpTypePointer UniformConstant [[OtherBufferArrayType]]
27+ ; CHECK-DAG: [[OtherVar]] = OpVariable [[OtherArrayPtrType]] UniformConstant
28+
2229; CHECK: {{%[0-9]+}} = OpFunction {{%[0-9]+}} DontInline {{%[0-9]+}}
2330; CHECK-NEXT: OpLabel
2431define void @main () #0 {
@@ -36,4 +43,23 @@ define void @main() #0 {
3643 ret void
3744}
3845
46+ ; CHECK: {{%[0-9]+}} = OpFunction {{%[0-9]+}} DontInline {{%[0-9]+}}
47+ ; CHECK-NEXT: OpLabel
48+ define void @DifferentArraySizesAreDifferentVariables () #0 {
49+ ; Make sure we use different variables when the array sizes are different
50+ ; same in case one function calls the other.
51+ ; CHECK: [[ac:%[0-9]+]] = OpAccessChain [[BufferPtrType]] [[Var]] [[Zero]]
52+ ; CHECK: [[buffer:%[0-9]+]] = OpLoad [[BufferType]] [[ac]]
53+ %buffer0 = call target ("spirv.Image" , i32 , 0 , 2 , 0 , 0 , 1 , 24 )
54+ @llvm.spv.handle.fromBinding.tspirv.Image_f32_0_2_0_0_1_24 (
55+ i32 3 , i32 4 , i32 3 , i32 0 , i1 false )
56+
57+ ; CHECK: [[ac:%[0-9]+]] = OpAccessChain [[BufferPtrType]] [[OtherVar]] [[One]]
58+ ; CHECK: [[buffer:%[0-9]+]] = OpLoad [[BufferType]] [[ac]]
59+ %buffer1 = call target ("spirv.Image" , i32 , 0 , 2 , 0 , 0 , 1 , 24 )
60+ @llvm.spv.handle.fromBinding.tspirv.Image_f32_0_2_0_0_1_24 (
61+ i32 3 , i32 4 , i32 5 , i32 1 , i1 false )
62+ ret void
63+ }
64+
3965attributes #0 = { convergent noinline norecurse "frame-pointer" ="all" "hlsl.numthreads" ="1,1,1" "hlsl.shader" ="compute" "no-trapping-math" ="true" "stack-protector-buffer-size" ="8" }
0 commit comments