1 ; RUN: llvm-link %s %S/Inputs/testlink.ll -S | FileCheck %s
3 ; CHECK: %Ty2 = type { %Ty1* }
4 ; CHECK: %Ty1 = type { %Ty2* }
8 ; CHECK: %intlist = type { %intlist*, i32 }
9 %intlist = type { %intlist*, i32 }
11 ; The uses of intlist in the other file should be remapped.
12 ; CHECK-NOT: {{%intlist.[0-9]}}
14 ; CHECK: %VecSize = type { <5 x i32> }
15 ; CHECK: %VecSize.{{[0-9]}} = type { <10 x i32> }
16 %VecSize = type { <5 x i32> }
18 %Struct1 = type opaque
19 @S1GV = external global %Struct1*
22 @GVTy1 = external global %Ty1*
23 @GVTy2 = global %Ty2* null
26 ; This should stay the same
27 ; CHECK: @MyIntList = global %intlist { %intlist* null, i32 17 }
28 @MyIntList = global %intlist { %intlist* null, i32 17 }
31 ; Nothing to link here.
33 ; CHECK: @0 = external global i32
34 @0 = external global i32
35 ; CHECK: @Inte = global i32 1
38 ; Intern1 is intern in both files, rename testlink2's.
39 ; CHECK: @Intern1 = internal constant i32 42
40 @Intern1 = internal constant i32 42
42 ; This should get renamed since there is a definition that is non-internal in
44 ; CHECK: @Intern2{{[0-9]+}} = internal constant i32 792
45 @Intern2 = internal constant i32 792
48 ; CHECK: @MyVarPtr = linkonce global { i32* } { i32* @MyVar }
49 @MyVarPtr = linkonce global { i32* } { i32* @MyVar }
51 ; CHECK: @MyVar = global i32 4
52 @MyVar = external global i32
54 ; Take value from other module.
55 ; CHECK: AConst = constant i32 1234
56 @AConst = linkonce constant i32 123
58 ; Renamed version of Intern1.
59 ; CHECK: @Intern1{{[0-9]+}} = internal constant i32 52
62 ; Globals linked from testlink2.
63 ; CHECK: @Intern2 = constant i32 12345
65 ; CHECK: @MyIntListPtr = constant
66 ; CHECK: @1 = constant i32 412
71 declare void @print(i32)
74 %v1 = load i32* @MyVar
75 call void @print(i32 %v1)
76 %idx = getelementptr %intlist* @MyIntList, i64 0, i32 1
78 call void @print(i32 %v2)
79 %1 = call i32 @foo(i32 5)
80 %v3 = load i32* @MyVar
81 call void @print(i32 %v3)
83 call void @print(i32 %v4)
87 define internal void @testintern() {
91 define internal void @Testintern() {
95 define void @testIntern() {
99 declare void @VecSizeCrash(%VecSize)