1 ; RUN: llvm-link %s %S/Inputs/testlink.ll -S | FileCheck %s
3 ; CHECK: %Ty1.1 = type { ptr }
4 ; CHECK: %Ty2 = type { ptr, ptr }
6 %Ty2 = type { ptr, ptr }
8 ; CHECK: %intlist = type { ptr, i32 }
9 %intlist = type { ptr, 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 { ptr null, ptr null }
26 ; This should stay the same
27 ; CHECK-DAG: @MyIntList = global %intlist { ptr null, i32 17 }
28 @MyIntList = global %intlist { ptr null, i32 17 }
31 ; Nothing to link here.
33 ; CHECK-DAG: @0 = external global i32
34 @0 = external global i32
40 ; CHECK-DAG: @Inte = global i32 1
43 ; Intern1 is intern in both files, rename testlink2's.
44 ; CHECK-DAG: @Intern1 = internal constant i32 42
45 @Intern1 = internal constant i32 42
47 @UseIntern1 = global ptr @Intern1
49 ; This should get renamed since there is a definition that is non-internal in
51 ; CHECK-DAG: @Intern2.{{[0-9]+}} = internal constant i32 792
52 @Intern2 = internal constant i32 792
54 @UseIntern2 = global ptr @Intern2
56 ; CHECK-DAG: @MyVarPtr = linkonce global { ptr } { ptr @MyVar }
57 @MyVarPtr = linkonce global { ptr } { ptr @MyVar }
59 @UseMyVarPtr = global ptr @MyVarPtr
61 ; CHECK-DAG: @MyVar = global i32 4
62 @MyVar = external global i32
64 ; Take value from other module.
65 ; CHECK-DAG: AConst = constant i32 1234
66 @AConst = linkonce constant i32 123
68 ; Renamed version of Intern1.
69 ; CHECK-DAG: @Intern1.{{[0-9]+}} = internal constant i32 52
72 ; Globals linked from testlink2.
73 ; CHECK-DAG: @Intern2 = constant i32 12345
75 ; CHECK-DAG: @MyIntListPtr = constant
76 ; CHECK-DAG: @1 = constant i32 412
81 declare void @print(i32)
84 %v1 = load i32, ptr @MyVar
85 call void @print(i32 %v1)
86 %idx = getelementptr %intlist, ptr @MyIntList, i64 0, i32 1
87 %v2 = load i32, ptr %idx
88 call void @print(i32 %v2)
89 %1 = call i32 @foo(i32 5)
90 %v3 = load i32, ptr @MyVar
91 call void @print(i32 %v3)
92 %v4 = load i32, ptr %idx
93 call void @print(i32 %v4)
97 define internal void @testintern() {
101 define internal void @Testintern() {
105 define void @testIntern() {
109 define void @VecSizeCrash(%VecSize) {