1*cee313d2SEric Christopher; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t %s 2*cee313d2SEric Christopher; RUN: llvm-modextract -n 0 -o - %t | llvm-dis | FileCheck --check-prefix=THIN %s 3*cee313d2SEric Christopher; RUN: llvm-modextract -n 1 -o - %t | llvm-dis | FileCheck --check-prefix=MERGED %s 4*cee313d2SEric Christopher 5*cee313d2SEric Christophertarget datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" 6*cee313d2SEric Christophertarget triple = "x86_64-pc-windows-msvc19.0.24215" 7*cee313d2SEric Christopher 8*cee313d2SEric Christopher; Internal comdat leader with type metadata. All comdat members need to live 9*cee313d2SEric Christopher; in the merged module, and the comdat needs to be renamed. 10*cee313d2SEric Christopher; MERGED: ${{"?lwt[^ ]+}} = comdat any 11*cee313d2SEric Christopher$lwt = comdat any 12*cee313d2SEric Christopher 13*cee313d2SEric Christopher; External comdat leader, type metadata on non-leader. All comdat 14*cee313d2SEric Christopher; members need to live in the merged module, internal members need to 15*cee313d2SEric Christopher; be renamed. 16*cee313d2SEric Christopher; MERGED: $nlwt = comdat any 17*cee313d2SEric Christopher$nlwt = comdat any 18*cee313d2SEric Christopher 19*cee313d2SEric Christopher; Comdat with two members without type metadata. All comdat members live in 20*cee313d2SEric Christopher; the ThinLTO module and no renaming needs to take place. 21*cee313d2SEric Christopher; THIN: $nt = comdat any 22*cee313d2SEric Christopher$nt = comdat any 23*cee313d2SEric Christopher 24*cee313d2SEric Christopher; MERGED: @lwt_aliasee = private unnamed_addr global 25*cee313d2SEric Christopher; MERGED-SAME: comdat(${{"?lwt[^ ]+}}) 26*cee313d2SEric Christopher@lwt_aliasee = private unnamed_addr global [1 x i8*] [i8* null], comdat($lwt), !type !0 27*cee313d2SEric Christopher 28*cee313d2SEric Christopher; MERGED: {{@"?lwt_nl[^ ]+}} = hidden unnamed_addr global 29*cee313d2SEric Christopher; MERGED-SAME: comdat(${{"?lwt[^ ]+}}) 30*cee313d2SEric Christopher; THIN: {{@"?lwt_nl[^ ]+}} = external hidden 31*cee313d2SEric Christopher@lwt_nl = internal unnamed_addr global i32 0, comdat($lwt) 32*cee313d2SEric Christopher 33*cee313d2SEric Christopher; MERGED: @nlwt_aliasee = private unnamed_addr global 34*cee313d2SEric Christopher; MERGED-SAME: comdat($nlwt) 35*cee313d2SEric Christopher@nlwt_aliasee = private unnamed_addr global [1 x i8*] [i8* null], comdat($nlwt), !type !0 36*cee313d2SEric Christopher 37*cee313d2SEric Christopher; MERGED: @nlwt = unnamed_addr global 38*cee313d2SEric Christopher; MERGED-SAME: comdat 39*cee313d2SEric Christopher; THIN: @nlwt = external 40*cee313d2SEric Christopher@nlwt = unnamed_addr global i32 0, comdat 41*cee313d2SEric Christopher 42*cee313d2SEric Christopher; THIN: @nt = internal 43*cee313d2SEric Christopher; THIN-SAME: comdat 44*cee313d2SEric Christopher@nt = internal unnamed_addr global [1 x i8*] [i8* null], comdat 45*cee313d2SEric Christopher 46*cee313d2SEric Christopher; THIN: @nt_nl = internal 47*cee313d2SEric Christopher; THIN-SAME: comdat($nt) 48*cee313d2SEric Christopher@nt_nl = internal unnamed_addr global i32 0, comdat($nt) 49*cee313d2SEric Christopher 50*cee313d2SEric Christopher; MERGED: {{@"?lwt[^ ]+}} = hidden unnamed_addr alias 51*cee313d2SEric Christopher; THIN: {{@"?lwt[^ ]+}} = external hidden 52*cee313d2SEric Christopher@lwt = internal unnamed_addr alias [1 x i8*], [1 x i8*]* @lwt_aliasee 53*cee313d2SEric Christopher 54*cee313d2SEric Christopher; MERGED: {{@"?nlwt_nl[^ ]+}} = hidden unnamed_addr alias 55*cee313d2SEric Christopher; THIN: {{@"?nlwt_nl[^ ]+}} = external hidden 56*cee313d2SEric Christopher@nlwt_nl = internal unnamed_addr alias [1 x i8*], [1 x i8*]* @nlwt_aliasee 57*cee313d2SEric Christopher 58*cee313d2SEric Christopher; The functions below exist just to make sure the globals are used. 59*cee313d2SEric Christopherdefine i8* @lwt_fun() { 60*cee313d2SEric Christopher %1 = load i32, i32* @lwt_nl 61*cee313d2SEric Christopher %2 = getelementptr inbounds [1 x i8*], [1 x i8*]* @lwt, i32 0, i32 %1 62*cee313d2SEric Christopher %3 = load i8*, i8** %2 63*cee313d2SEric Christopher ret i8* %3 64*cee313d2SEric Christopher} 65*cee313d2SEric Christopher 66*cee313d2SEric Christopherdefine i8* @nlwt_fun() { 67*cee313d2SEric Christopher %1 = load i32, i32* @nlwt 68*cee313d2SEric Christopher %2 = getelementptr inbounds [1 x i8*], [1 x i8*]* @nlwt_nl, i32 0, i32 %1 69*cee313d2SEric Christopher %3 = load i8*, i8** %2 70*cee313d2SEric Christopher ret i8* %3 71*cee313d2SEric Christopher} 72*cee313d2SEric Christopher 73*cee313d2SEric Christopherdefine i8* @nt_fun() { 74*cee313d2SEric Christopher %1 = load i32, i32* @nt_nl 75*cee313d2SEric Christopher %2 = getelementptr inbounds [1 x i8*], [1 x i8*]* @nt, i32 0, i32 %1 76*cee313d2SEric Christopher %3 = load i8*, i8** %2 77*cee313d2SEric Christopher ret i8* %3 78*cee313d2SEric Christopher} 79*cee313d2SEric Christopher 80*cee313d2SEric Christopher!0 = !{i64 8, !"?AVA@@"} 81