1; RUN: llvm-link %s %S/Inputs/testlink.ll -S | FileCheck %s 2 3; CHECK: %Ty2 = type { %Ty1* } 4; CHECK: %Ty1 = type { %Ty2* } 5%Ty1 = type opaque 6%Ty2 = type { %Ty1* } 7 8; CHECK: %intlist = type { %intlist*, i32 } 9%intlist = type { %intlist*, i32 } 10 11; The uses of intlist in the other file should be remapped. 12; CHECK-NOT: {{%intlist.[0-9]}} 13 14; CHECK: %VecSize = type { <5 x i32> } 15; CHECK: %VecSize.{{[0-9]}} = type { <10 x i32> } 16%VecSize = type { <5 x i32> } 17 18%Struct1 = type opaque 19@S1GV = external global %Struct1* 20 21 22@GVTy1 = external global %Ty1* 23@GVTy2 = global %Ty2* null 24 25 26; This should stay the same 27; CHECK-DAG: @MyIntList = global %intlist { %intlist* null, i32 17 } 28@MyIntList = global %intlist { %intlist* null, i32 17 } 29 30 31; Nothing to link here. 32 33; CHECK-DAG: @0 = external global i32 34@0 = external global i32 35; CHECK-DAG: @Inte = global i32 1 36@Inte = global i32 1 37 38; Intern1 is intern in both files, rename testlink2's. 39; CHECK-DAG: @Intern1 = internal constant i32 42 40@Intern1 = internal constant i32 42 41 42@UseIntern1 = global i32* @Intern1 43 44; This should get renamed since there is a definition that is non-internal in 45; the other module. 46; CHECK-DAG: @Intern2{{[0-9]+}} = internal constant i32 792 47@Intern2 = internal constant i32 792 48 49@UseIntern2 = global i32* @Intern2 50 51; CHECK-DAG: @MyVarPtr = linkonce global { i32* } { i32* @MyVar } 52@MyVarPtr = linkonce global { i32* } { i32* @MyVar } 53 54@UseMyVarPtr = global { i32* }* @MyVarPtr 55 56; CHECK-DAG: @MyVar = global i32 4 57@MyVar = external global i32 58 59; Take value from other module. 60; CHECK-DAG: AConst = constant i32 1234 61@AConst = linkonce constant i32 123 62 63; Renamed version of Intern1. 64; CHECK-DAG: @Intern1{{[0-9]+}} = internal constant i32 52 65 66 67; Globals linked from testlink2. 68; CHECK-DAG: @Intern2 = constant i32 12345 69 70; CHECK-DAG: @MyIntListPtr = constant 71; CHECK-DAG: @1 = constant i32 412 72 73 74declare i32 @foo(i32) 75 76declare void @print(i32) 77 78define void @main() { 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) 89 ret void 90} 91 92define internal void @testintern() { 93 ret void 94} 95 96define internal void @Testintern() { 97 ret void 98} 99 100define void @testIntern() { 101 ret void 102} 103 104declare void @VecSizeCrash(%VecSize) 105