1 ; RUN: split-file %s %t
2 ; RUN: llvm-as -o %t1.bc %t/f01.ll
3 ; RUN: llvm-as -o %t2.bc %t/f02.ll
4 ; RUN: llvm-link %t1.bc %t2.bc -o %t3.bc
5 ; RUN: llvm-dis -o - %t3.bc | FileCheck %s
7 ; Make sure we can link files with clashing intrinsic names using unnamed types.
13 ; CHECK-LABEL: @test01(
14 ; CHECK: %cmp1 = icmp ne %0* %arg, null
15 ; CHECK-NEXT: %c1 = call %0* @llvm.ssa.copy.p0s_s.0(%0* %arg)
16 ; CHECK-NEXT: %c2 = call %1* @llvm.ssa.copy.p0s_s.1(%1* %tmp)
17 ; CHECK-NEXT: %c3a = call %0** @llvm.ssa.copy.p0p0s_s.0(%0** %arg2)
18 ; CHECK-NEXT: %c3b = call %0** @llvm.ssa.copy.p0p0s_s.0(%0** %arg2)
19 ; CHECK-NEXT: %c4a = call %1** @llvm.ssa.copy.p0p0s_s.1(%1** %tmp2)
20 ; CHECK-NEXT: %c4ba = call %1** @llvm.ssa.copy.p0p0s_s.1(%1** %tmp2)
21 ; CHECK-NEXT: %c5 = call %0*** @llvm.ssa.copy.p0p0p0s_s.0(%0*** %arg3)
22 ; CHECK-NEXT: %c6 = call %1*** @llvm.ssa.copy.p0p0p0s_s.1(%1*** %tmp3)
24 define void @test01(%0* %arg, %1* %tmp, %1** %tmp2, %0** %arg2, %1*** %tmp3, %0*** %arg3) {
26 %cmp1 = icmp ne %0* %arg, null
27 %c1 = call %0* @llvm.ssa.copy.p0s_s.0(%0* %arg)
28 %c2 = call %1* @llvm.ssa.copy.p0s_s.1(%1* %tmp)
29 %c3a = call %0** @llvm.ssa.copy.p0p0s_s.1(%0** %arg2)
30 %c3b = call %0** @llvm.ssa.copy.p0p0s_s.1(%0** %arg2)
31 %c4a = call %1** @llvm.ssa.copy.p0p0s_s.0(%1** %tmp2)
32 %c4ba = call %1** @llvm.ssa.copy.p0p0s_s.0(%1** %tmp2)
33 %c5 = call %0*** @llvm.ssa.copy.p0p0p0s_s.1(%0*** %arg3)
34 %c6 = call %1*** @llvm.ssa.copy.p0p0p0s_s.0(%1*** %tmp3)
38 declare %0* @llvm.ssa.copy.p0s_s.0(%0* returned)
40 declare %1* @llvm.ssa.copy.p0s_s.1(%1* returned)
42 declare %0** @llvm.ssa.copy.p0p0s_s.1(%0** returned)
44 declare %1** @llvm.ssa.copy.p0p0s_s.0(%1** returned)
46 declare %0*** @llvm.ssa.copy.p0p0p0s_s.1(%0*** returned)
48 declare %1*** @llvm.ssa.copy.p0p0p0s_s.0(%1*** returned)
50 ; now with recycling of previous declarations:
51 ; CHECK-LABEL: @test02(
52 ; CHECK: %cmp1 = icmp ne %0* %arg, null
53 ; CHECK-NEXT: %c4a = call %1** @llvm.ssa.copy.p0p0s_s.1(%1** %tmp2)
54 ; CHECK-NEXT: %c6 = call %1*** @llvm.ssa.copy.p0p0p0s_s.1(%1*** %tmp3)
55 ; CHECK-NEXT: %c1 = call %0* @llvm.ssa.copy.p0s_s.0(%0* %arg)
56 ; CHECK-NEXT: %c2 = call %1* @llvm.ssa.copy.p0s_s.1(%1* %tmp)
57 ; CHECK-NEXT: %c3b = call %0** @llvm.ssa.copy.p0p0s_s.0(%0** %arg2)
58 ; CHECK-NEXT: %c4ba = call %1** @llvm.ssa.copy.p0p0s_s.1(%1** %tmp2)
59 ; CHECK-NEXT: %c5 = call %0*** @llvm.ssa.copy.p0p0p0s_s.0(%0*** %arg3)
61 define void @test02(%0* %arg, %1* %tmp, %1** %tmp2, %0** %arg2, %1*** %tmp3, %0*** %arg3) {
63 %cmp1 = icmp ne %0* %arg, null
64 %c4a = call %1** @llvm.ssa.copy.p0p0s_s.0(%1** %tmp2)
65 %c6 = call %1*** @llvm.ssa.copy.p0p0p0s_s.0(%1*** %tmp3)
66 %c1 = call %0* @llvm.ssa.copy.p0s_s.0(%0* %arg)
67 %c2 = call %1* @llvm.ssa.copy.p0s_s.1(%1* %tmp)
68 %c3b = call %0** @llvm.ssa.copy.p0p0s_s.1(%0** %arg2)
69 %c4ba = call %1** @llvm.ssa.copy.p0p0s_s.0(%1** %tmp2)
70 %c5 = call %0*** @llvm.ssa.copy.p0p0p0s_s.1(%0*** %arg3)
78 ; CHECK-LABEL: @test03(
79 ; CHECK: %cmp1 = icmp ne %3* %arg, null
80 ; CHECK-NEXT: %c1 = call %3* @llvm.ssa.copy.p0s_s.2(%3* %arg)
81 ; CHECK-NEXT: %c2 = call %2* @llvm.ssa.copy.p0s_s.3(%2* %tmp)
82 ; CHECK-NEXT: %c3 = call %3** @llvm.ssa.copy.p0p0s_s.2(%3** %arg2)
83 ; CHECK-NEXT: %c4 = call %2** @llvm.ssa.copy.p0p0s_s.3(%2** %tmp2)
85 define void @test03(%1* %tmp, %2* %arg, %1** %tmp2, %2** %arg2) {
87 %cmp1 = icmp ne %2* %arg, null
88 %c1 = call %2* @llvm.ssa.copy.p0s_s.0(%2* %arg)
89 %c2 = call %1* @llvm.ssa.copy.p0s_s.1(%1* %tmp)
90 %c3 = call %2** @llvm.ssa.copy.p0p0s_s.1(%2** %arg2)
91 %c4 = call %1** @llvm.ssa.copy.p0p0s_s.0(%1** %tmp2)
95 declare %2* @llvm.ssa.copy.p0s_s.0(%2* returned)
97 declare %1* @llvm.ssa.copy.p0s_s.1(%1* returned)
99 declare %2** @llvm.ssa.copy.p0p0s_s.1(%2** returned)
101 declare %1** @llvm.ssa.copy.p0p0s_s.0(%1** returned)