@@ -28,6 +28,7 @@ declare target("spirv.VulkanBuffer", [0 x i32], 12, 1) @llvm.spv.resource.handle
2828; CHECK: [[BufferPtrType:%.+]] = OpTypePointer StorageBuffer [[BufferType]]
2929; CHECK-DAG: [[zero:%[0-9]+]] = OpConstant [[int]] 0
3030; CHECK-DAG: [[one:%[0-9]+]] = OpConstant [[int]] 1
31+ ; CHECK-DAG: [[two:%[0-9]+]] = OpConstant [[int]] 2
3132; CHECK-DAG: [[BufferVar]] = OpVariable [[BufferPtrType]] StorageBuffer
3233; CHECK-DAG: [[RWBufferVar]] = OpVariable [[RWBufferPtrType]] StorageBuffer
3334
@@ -36,22 +37,35 @@ define void @main() local_unnamed_addr #1 {
3637entry:
3738
3839; CHECK-DAG: [[BufferHandle:%.+]] = OpCopyObject [[BufferPtrType]] [[BufferVar]]
40+ ; CHECK-DAG: [[BufferHandle2:%.+]] = OpCopyObject [[BufferPtrType]] [[BufferVar]]
3941; CHECK-DAG: [[RWBufferHandle:%.+]] = OpCopyObject [[RWBufferPtrType]] [[RWBufferVar]]
40- %_ZL1i_h.i.i = tail call target ("spirv.VulkanBuffer" , [0 x i32 ], 12 , 0 ) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0i32_12_0t (i32 0 , i32 0 , i32 1 , i32 0 , i1 false )
41-
42- %_ZL1o_h.i.i = tail call target ("spirv.VulkanBuffer" , [0 x i32 ], 12 , 1 ) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0i32_12_1t (i32 0 , i32 1 , i32 1 , i32 0 , i1 false )
42+ %BufferHandle = tail call target ("spirv.VulkanBuffer" , [0 x i32 ], 12 , 0 ) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0i32_12_0t (i32 0 , i32 0 , i32 1 , i32 0 , i1 false )
43+ %BufferHandle2 = tail call target ( "spirv.VulkanBuffer" , [ 0 x i32 ], 12 , 0 ) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0i32_12_0t ( i32 0 , i32 0 , i32 1 , i32 0 , i1 false )
44+ %RWBufferHandle = tail call target ("spirv.VulkanBuffer" , [0 x i32 ], 12 , 1 ) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0i32_12_1t (i32 0 , i32 1 , i32 1 , i32 0 , i1 false )
4345
4446; CHECK: [[AC:%.+]] = OpAccessChain {{.*}} [[BufferHandle]] [[zero]] [[one]]
45- %0 = tail call noundef nonnull align 4 dereferenceable (4 ) ptr addrspace (11 ) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0i32_12_0t (target ("spirv.VulkanBuffer" , [0 x i32 ], 12 , 0 ) %_ZL1i_h.i.i , i32 1 )
47+ %0 = tail call noundef nonnull align 4 dereferenceable (4 ) ptr addrspace (11 ) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0i32_12_0t (target ("spirv.VulkanBuffer" , [0 x i32 ], 12 , 0 ) %BufferHandle , i32 1 )
4648
4749; CHECK: [[LD:%.+]] = OpLoad [[int]] [[AC]] Aligned 4
4850 %1 = load i32 , ptr addrspace (11 ) %0 , align 4 , !tbaa !3
4951
5052; CHECK: [[AC:%.+]] = OpAccessChain {{.*}} [[RWBufferHandle]] [[zero]] [[zero]]
51- %2 = tail call noundef nonnull align 4 dereferenceable (4 ) ptr addrspace (11 ) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0i32_12_1t (target ("spirv.VulkanBuffer" , [0 x i32 ], 12 , 1 ) %_ZL1o_h.i.i , i32 0 )
53+ %2 = tail call noundef nonnull align 4 dereferenceable (4 ) ptr addrspace (11 ) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0i32_12_1t (target ("spirv.VulkanBuffer" , [0 x i32 ], 12 , 1 ) %RWBufferHandle , i32 0 )
5254
5355; CHECK: OpStore [[AC]] [[LD]]
5456 store i32 %1 , ptr addrspace (11 ) %2 , align 4 , !tbaa !3
57+
58+ ; CHECK: [[AC:%.+]] = OpAccessChain {{.*}} [[BufferHandle2]] [[zero]] [[two]]
59+ %3 = tail call noundef nonnull align 4 dereferenceable (4 ) ptr addrspace (11 ) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0i32_12_0t (target ("spirv.VulkanBuffer" , [0 x i32 ], 12 , 0 ) %BufferHandle2 , i32 2 )
60+
61+ ; CHECK: [[LD:%.+]] = OpLoad [[int]] [[AC]] Aligned 4
62+ %4 = load i32 , ptr addrspace (11 ) %3 , align 4 , !tbaa !3
63+
64+ ; CHECK: [[AC:%.+]] = OpAccessChain {{.*}} [[RWBufferHandle]] [[zero]] [[zero]]
65+ %5 = tail call noundef nonnull align 4 dereferenceable (4 ) ptr addrspace (11 ) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0i32_12_1t (target ("spirv.VulkanBuffer" , [0 x i32 ], 12 , 1 ) %RWBufferHandle , i32 0 )
66+
67+ ; CHECK: OpStore [[AC]] [[LD]]
68+ store i32 %4 , ptr addrspace (11 ) %5 , align 4 , !tbaa !3
5569 ret void
5670}
5771
0 commit comments