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 36define i32* @use0() { 37 ret i32* @0 38} 39 40; CHECK-DAG: @Inte = global i32 1 41@Inte = global i32 1 42 43; Intern1 is intern in both files, rename testlink2's. 44; CHECK-DAG: @Intern1 = internal constant i32 42 45@Intern1 = internal constant i32 42 46 47@UseIntern1 = global i32* @Intern1 48 49; This should get renamed since there is a definition that is non-internal in 50; the other module. 51; CHECK-DAG: @Intern2.{{[0-9]+}} = internal constant i32 792 52@Intern2 = internal constant i32 792 53 54@UseIntern2 = global i32* @Intern2 55 56; CHECK-DAG: @MyVarPtr = linkonce global { i32* } { i32* @MyVar } 57@MyVarPtr = linkonce global { i32* } { i32* @MyVar } 58 59@UseMyVarPtr = global { i32* }* @MyVarPtr 60 61; CHECK-DAG: @MyVar = global i32 4 62@MyVar = external global i32 63 64; Take value from other module. 65; CHECK-DAG: AConst = constant i32 1234 66@AConst = linkonce constant i32 123 67 68; Renamed version of Intern1. 69; CHECK-DAG: @Intern1.{{[0-9]+}} = internal constant i32 52 70 71 72; Globals linked from testlink2. 73; CHECK-DAG: @Intern2 = constant i32 12345 74 75; CHECK-DAG: @MyIntListPtr = constant 76; CHECK-DAG: @1 = constant i32 412 77 78 79declare i32 @foo(i32) 80 81declare void @print(i32) 82 83define void @main() { 84 %v1 = load i32, i32* @MyVar 85 call void @print(i32 %v1) 86 %idx = getelementptr %intlist, %intlist* @MyIntList, i64 0, i32 1 87 %v2 = load i32, i32* %idx 88 call void @print(i32 %v2) 89 %1 = call i32 @foo(i32 5) 90 %v3 = load i32, i32* @MyVar 91 call void @print(i32 %v3) 92 %v4 = load i32, i32* %idx 93 call void @print(i32 %v4) 94 ret void 95} 96 97define internal void @testintern() { 98 ret void 99} 100 101define internal void @Testintern() { 102 ret void 103} 104 105define void @testIntern() { 106 ret void 107} 108 109define void @VecSizeCrash(%VecSize) { 110 ret void 111} 112