Debian Codegraph @

llvm/test/CodeGen/SPIRV/pointers/type-deduce-call-no-bitcast.ll

raw
1 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3
4 ; CHECK-SPIRV-DAG: OpName %[[Foo:.*]] "foo"
5 ; CHECK-SPIRV-DAG: %[[TyChar:.*]] = OpTypeInt 8 0
6 ; CHECK-SPIRV-DAG: %[[TyVoid:.*]] = OpTypeVoid
7 ; CHECK-SPIRV-DAG: %[[TyGenPtrChar:.*]] = OpTypePointer Generic %[[TyChar]]
8 ; CHECK-SPIRV-DAG: %[[TyFunBar:.*]] = OpTypeFunction %[[TyVoid]] %[[TyGenPtrChar]]
9 ; CHECK-SPIRV-DAG: %[[TyLong:.*]] = OpTypeInt 64 0
10 ; CHECK-SPIRV-DAG: %[[TyGenPtrPtrChar:.*]] = OpTypePointer Generic %[[TyGenPtrChar]]
11 ; CHECK-SPIRV-DAG: %[[TyFunFoo:.*]] = OpTypeFunction %[[TyVoid]] %[[TyLong]] %[[TyGenPtrPtrChar]] %[[TyGenPtrPtrChar]]
12 ; CHECK-SPIRV-DAG: %[[TyStruct:.*]] = OpTypeStruct %[[TyLong]]
13 ; CHECK-SPIRV-DAG: %[[Const100:.*]] = OpConstant %[[TyLong]] 100
14 ; CHECK-SPIRV-DAG: %[[TyFunPtrGenPtrChar:.*]] = OpTypePointer Function %[[TyGenPtrChar]]
15 ; CHECK-SPIRV-DAG: %[[TyPtrStruct:.*]] = OpTypePointer Generic %[[TyStruct]]
16 ; CHECK-SPIRV-DAG: %[[TyPtrLong:.*]] = OpTypePointer Generic %[[TyLong]]
17
18 ; CHECK-SPIRV: %[[Bar:.*]] = OpFunction %[[TyVoid]] None %[[TyFunBar]]
19 ; CHECK-SPIRV: %[[BarArg:.*]] = OpFunctionParameter %[[TyGenPtrChar]]
20 ; CHECK-SPIRV-NEXT: OpLabel
21 ; CHECK-SPIRV-NEXT: OpVariable %[[TyFunPtrGenPtrChar]] Function
22 ; CHECK-SPIRV-NEXT: OpVariable %[[TyFunPtrGenPtrChar]] Function
23 ; CHECK-SPIRV-NEXT: OpVariable %[[TyFunPtrGenPtrChar]] Function
24 ; CHECK-SPIRV: %[[Var1:.*]] = OpPtrCastToGeneric %[[TyGenPtrPtrChar]] %[[#]]
25 ; CHECK-SPIRV: %[[Var2:.*]] = OpPtrCastToGeneric %[[TyGenPtrPtrChar]] %[[#]]
26 ; CHECK-SPIRV: OpStore %[[#]] %[[BarArg]]
27 ; CHECK-SPIRV-NEXT: OpFunctionCall %[[TyVoid]] %[[Foo]] %[[Const100]] %[[Var1]] %[[Var2]]
28 ; CHECK-SPIRV-NEXT: OpFunctionCall %[[TyVoid]] %[[Foo]] %[[Const100]] %[[Var2]] %[[Var1]]
29
30 ; CHECK-SPIRV: %[[Foo]] = OpFunction %[[TyVoid]] None %[[TyFunFoo]]
31 ; CHECK-SPIRV-NEXT: OpFunctionParameter %[[TyLong]]
32 ; CHECK-SPIRV-NEXT: OpFunctionParameter %[[TyGenPtrPtrChar]]
33 ; CHECK-SPIRV-NEXT: OpFunctionParameter %[[TyGenPtrPtrChar]]
34
35 %class.CustomType = type { i64 }
36
37 @G = global ptr addrspace(4) null
38
39 define linkonce_odr dso_local spir_func void @bar(ptr addrspace(4) noundef %first) {
40 entry:
41 %first.addr = alloca ptr addrspace(4)
42 %first.addr.ascast = addrspacecast ptr %first.addr to ptr addrspace(4)
43 %temp = alloca ptr addrspace(4), align 8
44 %temp.ascast = addrspacecast ptr %temp to ptr addrspace(4)
45 store ptr addrspace(4) %first, ptr %first.addr
46 call spir_func void @foo(i64 noundef 100, ptr addrspace(4) noundef dereferenceable(8) %first.addr.ascast, ptr addrspace(4) noundef dereferenceable(8) %temp.ascast)
47 call spir_func void @foo(i64 noundef 100, ptr addrspace(4) noundef dereferenceable(8) %temp.ascast, ptr addrspace(4) noundef dereferenceable(8) %first.addr.ascast)
48 %var = alloca ptr addrspace(4), align 8
49 store ptr addrspace(4) null, ptr %var
50 ret void
51 }
52
53 define linkonce_odr dso_local spir_func void @foo(i64 noundef %offset, ptr addrspace(4) noundef dereferenceable(8) %in_acc1, ptr addrspace(4) noundef dereferenceable(8) %out_acc1) {
54 entry:
55 %r0 = load ptr addrspace(4), ptr addrspace(4) %in_acc1
56 %arrayidx = getelementptr inbounds %class.CustomType, ptr addrspace(4) %r0, i64 42
57 %r1 = load i64, ptr addrspace(4) %arrayidx
58 %r3 = load ptr addrspace(4), ptr addrspace(4) %out_acc1
59 %r4 = getelementptr %class.CustomType, ptr addrspace(4) %r3, i64 43
60 store i64 %r1, ptr addrspace(4) %r4
61 ret void
62 }
63