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