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 ; CHECK: %VecSize = type { <5 x i32> }
17 ; CHECK: %VecSize.{{[0-9]}} = type { <10 x i32> }
18 %VecSize = type { <5 x i32> }
20 %Struct1 = type opaque
21 @S1GV = external global %Struct1*
24 @GVTy1 = external global %Ty1*
25 @GVTy2 = global %Ty2* null
28 ; This should stay the same
29 ; CHECK: @MyIntList = global %intlist { %intlist* null, i32 17 }
30 @MyIntList = global %intlist { %intlist* null, i32 17 }
33 ; Nothing to link here.
35 ; CHECK: @0 = external global i32
36 @0 = external global i32
37 ; CHECK: @Inte = global i32 1
40 ; Intern1 is intern in both files, rename testlink2's.
41 ; CHECK: @Intern1 = internal constant i32 42
42 @Intern1 = internal constant i32 42
44 ; This should get renamed since there is a definition that is non-internal in
46 ; CHECK: @Intern2{{[0-9]+}} = internal constant i32 792
47 @Intern2 = internal constant i32 792
50 ; CHECK: @MyVarPtr = linkonce global { i32* } { i32* @MyVar }
51 @MyVarPtr = linkonce global { i32* } { i32* @MyVar }
53 ; CHECK: @MyVar = global i32 4
54 @MyVar = external global i32
56 ; Take value from other module.
57 ; CHECK: AConst = constant i32 1234
58 @AConst = linkonce constant i32 123
60 ; Renamed version of Intern1.
61 ; CHECK: @Intern1{{[0-9]+}} = internal constant i32 52
64 ; Globals linked from testlink2.
65 ; CHECK: @Intern2 = constant i32 12345
67 ; CHECK: @MyIntListPtr = constant
68 ; CHECK: @1 = constant i32 412
73 declare void @print(i32)
76 %v1 = load i32* @MyVar
77 call void @print(i32 %v1)
78 %idx = getelementptr %intlist* @MyIntList, i64 0, i32 1
80 call void @print(i32 %v2)
81 %1 = call i32 @foo(i32 5)
82 %v3 = load i32* @MyVar
83 call void @print(i32 %v3)
85 call void @print(i32 %v4)
89 define internal void @testintern() {
93 define internal void @Testintern() {
97 define void @testIntern() {
101 declare void @VecSizeCrash(%VecSize)