1 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
4 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
5 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
7 ; CHECK-DAG: %[[#Char:]] = OpTypeInt 8 0
8 ; CHECK-DAG: %[[#PtrChar:]] = OpTypePointer Function %[[#Char]]
10 %tprange = type { %tparray }
11 %tparray = type { [2 x i64] }
14 ; CHECK: %[[#FooVar:]] = OpVariable
15 ; CHECK: %[[#Casted1:]] = OpBitcast %[[#PtrChar]] %[[#FooVar]]
16 ; CHECK: OpLifetimeStart %[[#Casted1]], 72
17 ; CHECK: OpCopyMemorySized
19 ; CHECK: OpInBoundsPtrAccessChain
20 ; CHECK: %[[#Casted2:]] = OpBitcast %[[#PtrChar]] %[[#FooVar]]
21 ; CHECK: OpLifetimeStop %[[#Casted2]], 72
22 define spir_func void @foo(ptr noundef byval(%tprange) align 8 %_arg_UserRange) {
23 %RoundedRangeKernel = alloca %tprange, align 8
24 call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %RoundedRangeKernel)
25 call void @llvm.memcpy.p0.p0.i64(ptr align 8 %RoundedRangeKernel, ptr align 8 %_arg_UserRange, i64 16, i1 false)
26 %KernelFunc = getelementptr inbounds i8, ptr %RoundedRangeKernel, i64 16
27 call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %RoundedRangeKernel)
32 ; CHECK: %[[#BarVar:]] = OpVariable
33 ; CHECK: OpLifetimeStart %[[#BarVar]], 0
34 ; CHECK: OpCopyMemorySized
36 ; CHECK: OpInBoundsPtrAccessChain
37 ; CHECK: OpLifetimeStop %[[#BarVar]], 0
38 define spir_func void @bar(ptr noundef byval(%tprange) align 8 %_arg_UserRange) {
39 %RoundedRangeKernel = alloca %tprange, align 8
40 call void @llvm.lifetime.start.p0(i64 -1, ptr nonnull %RoundedRangeKernel)
41 call void @llvm.memcpy.p0.p0.i64(ptr align 8 %RoundedRangeKernel, ptr align 8 %_arg_UserRange, i64 16, i1 false)
42 %KernelFunc = getelementptr inbounds i8, ptr %RoundedRangeKernel, i64 16
43 call void @llvm.lifetime.end.p0(i64 -1, ptr nonnull %RoundedRangeKernel)
48 ; CHECK: %[[#TestVar:]] = OpVariable
49 ; CHECK: OpLifetimeStart %[[#TestVar]], 1
50 ; CHECK: OpCopyMemorySized
51 ; CHECK: OpInBoundsPtrAccessChain
52 ; CHECK: OpLifetimeStop %[[#TestVar]], 1
53 define spir_func void @test(ptr noundef align 8 %_arg) {
54 %var = alloca i8, align 8
55 call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %var)
56 call void @llvm.memcpy.p0.p0.i64(ptr align 8 %var, ptr align 8 %_arg, i64 1, i1 false)
57 %KernelFunc = getelementptr inbounds i8, ptr %var, i64 0
58 call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %var)
62 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
63 declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg)
64 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)