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-DAG: @MyIntList = global %intlist { %intlist* null, i32 17 }
28 @MyIntList = global %intlist { %intlist* null, i32 17 }
31 ; Nothing to link here.
33 ; CHECK-DAG: @0 = external global i32
34 @0 = external global i32
35 ; CHECK-DAG: @Inte = global i32 1
38 ; Intern1 is intern in both files, rename testlink2's.
39 ; CHECK-DAG: @Intern1 = internal constant i32 42
40 @Intern1 = internal constant i32 42
42 @UseIntern1 = global i32* @Intern1
44 ; This should get renamed since there is a definition that is non-internal in
46 ; CHECK-DAG: @Intern2{{[0-9]+}} = internal constant i32 792
47 @Intern2 = internal constant i32 792
49 @UseIntern2 = global i32* @Intern2
51 ; CHECK-DAG: @MyVarPtr = linkonce global { i32* } { i32* @MyVar }
52 @MyVarPtr = linkonce global { i32* } { i32* @MyVar }
54 @UseMyVarPtr = global { i32* }* @MyVarPtr
56 ; CHECK-DAG: @MyVar = global i32 4
57 @MyVar = external global i32
59 ; Take value from other module.
60 ; CHECK-DAG: AConst = constant i32 1234
61 @AConst = linkonce constant i32 123
63 ; Renamed version of Intern1.
64 ; CHECK-DAG: @Intern1{{[0-9]+}} = internal constant i32 52
67 ; Globals linked from testlink2.
68 ; CHECK-DAG: @Intern2 = constant i32 12345
70 ; CHECK-DAG: @MyIntListPtr = constant
71 ; CHECK-DAG: @1 = constant i32 412
76 declare void @print(i32)
79 %v1 = load i32, i32* @MyVar
80 call void @print(i32 %v1)
81 %idx = getelementptr %intlist, %intlist* @MyIntList, i64 0, i32 1
82 %v2 = load i32, i32* %idx
83 call void @print(i32 %v2)
84 %1 = call i32 @foo(i32 5)
85 %v3 = load i32, i32* @MyVar
86 call void @print(i32 %v3)
87 %v4 = load i32, i32* %idx
88 call void @print(i32 %v4)
92 define internal void @testintern() {
96 define internal void @Testintern() {
100 define void @testIntern() {
104 declare void @VecSizeCrash(%VecSize)