• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llvm-as < %s > %t.bc
2; RUN: llvm-as < %p/testlink2.ll > %t2.bc
3; RUN: llvm-link %t.bc %t2.bc -S | FileCheck %s
4
5; CHECK: %Ty2 = type { %Ty1* }
6; CHECK: %Ty1 = type { %Ty2* }
7%Ty1 = type opaque
8%Ty2 = type { %Ty1* }
9
10; CHECK: %intlist = type { %intlist*, i32 }
11%intlist = type { %intlist*, i32 }
12
13; The uses of intlist in the other file should be remapped.
14; CHECK-NOT: {{%intlist.[0-9]}}
15
16; CHECK: %VecSize = type { <5 x i32> }
17; CHECK: %VecSize.{{[0-9]}} = type { <10 x i32> }
18%VecSize = type { <5 x i32> }
19
20%Struct1 = type opaque
21@S1GV = external global %Struct1*
22
23
24@GVTy1 = external global %Ty1*
25@GVTy2 = global %Ty2* null
26
27
28; This should stay the same
29; CHECK: @MyIntList = global %intlist { %intlist* null, i32 17 }
30@MyIntList = global %intlist { %intlist* null, i32 17 }
31
32
33; Nothing to link here.
34
35; CHECK: @0 = external global i32
36@0 = external global i32
37; CHECK: @Inte = global i32 1
38@Inte = global i32 1
39
40; Intern1 is intern in both files, rename testlink2's.
41; CHECK: @Intern1 = internal constant i32 42
42@Intern1 = internal constant i32 42
43
44; This should get renamed since there is a definition that is non-internal in
45; the other module.
46; CHECK: @Intern2{{[0-9]+}} = internal constant i32 792
47@Intern2 = internal constant i32 792
48
49
50; CHECK: @MyVarPtr = linkonce global { i32* } { i32* @MyVar }
51@MyVarPtr = linkonce global { i32* } { i32* @MyVar }
52
53; CHECK: @MyVar = global i32 4
54@MyVar = external global i32
55
56; Take value from other module.
57; CHECK: AConst = constant i32 1234
58@AConst = linkonce constant i32 123
59
60; Renamed version of Intern1.
61; CHECK: @Intern1{{[0-9]+}} = internal constant i32 52
62
63
64; Globals linked from testlink2.
65; CHECK: @Intern2 = constant i32 12345
66
67; CHECK: @MyIntListPtr = constant
68; CHECK: @1 = constant i32 412
69
70
71declare i32 @foo(i32)
72
73declare void @print(i32)
74
75define void @main() {
76  %v1 = load i32* @MyVar
77  call void @print(i32 %v1)
78  %idx = getelementptr %intlist* @MyIntList, i64 0, i32 1
79  %v2 = load i32* %idx
80  call void @print(i32 %v2)
81  %1 = call i32 @foo(i32 5)
82  %v3 = load i32* @MyVar
83  call void @print(i32 %v3)
84  %v4 = load i32* %idx
85  call void @print(i32 %v4)
86  ret void
87}
88
89define internal void @testintern() {
90  ret void
91}
92
93define internal void @Testintern() {
94  ret void
95}
96
97define void @testIntern() {
98  ret void
99}
100
101declare void @VecSizeCrash(%VecSize)
102