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
5 ; CHECK: %Ty2 = type { %Ty1* }
6 ; CHECK: %Ty1 = type { %Ty2* }
10 ; CHECK: %intlist = type { %intlist*, i32 }
11 %intlist = type { %intlist*, i32 }
13 ; The uses of intlist in the other file should be remapped.
14 ; CHECK-NOT: {{%intlist.[0-9]}}
16 %Struct1 = type opaque
17 @S1GV = external global %Struct1*
20 @GVTy1 = external global %Ty1*
21 @GVTy2 = global %Ty2* null
24 ; This should stay the same
25 ; CHECK: @MyIntList = global %intlist { %intlist* null, i32 17 }
26 @MyIntList = global %intlist { %intlist* null, i32 17 }
29 ; Nothing to link here.
31 ; CHECK: @0 = external global i32
32 @0 = external global i32
33 ; CHECK: @Inte = global i32 1
36 ; Intern1 is intern in both files, rename testlink2's.
37 ; CHECK: @Intern1 = internal constant i32 42
38 @Intern1 = internal constant i32 42
40 ; This should get renamed since there is a definition that is non-internal in
42 ; CHECK: @Intern2{{[0-9]+}} = internal constant i32 792
43 @Intern2 = internal constant i32 792
46 ; CHECK: @MyVarPtr = linkonce global { i32* } { i32* @MyVar }
47 @MyVarPtr = linkonce global { i32* } { i32* @MyVar }
49 ; CHECK: @MyVar = global i32 4
50 @MyVar = external global i32
52 ; Take value from other module.
53 ; CHECK: AConst = constant i32 1234
54 @AConst = linkonce constant i32 123
56 ; Renamed version of Intern1.
57 ; CHECK: @Intern1{{[0-9]+}} = internal constant i32 52
60 ; Globals linked from testlink2.
61 ; CHECK: @Intern2 = constant i32 12345
63 ; CHECK: @MyIntListPtr = constant
64 ; CHECK: @1 = constant i32 412
69 declare void @print(i32)
72 %v1 = load i32* @MyVar
73 call void @print(i32 %v1)
74 %idx = getelementptr %intlist* @MyIntList, i64 0, i32 1
76 call void @print(i32 %v2)
77 %1 = call i32 @foo(i32 5)
78 %v3 = load i32* @MyVar
79 call void @print(i32 %v3)
81 call void @print(i32 %v4)
85 define internal void @testintern() {
89 define internal void @Testintern() {
93 define void @testIntern() {