1cee313d2SEric Christopher; Test to ensure that comdat is renamed consistently when comdat leader is 2cee313d2SEric Christopher; promoted and renamed due to an import. Required by COFF. 3cee313d2SEric Christopher 4cee313d2SEric Christopher; REQUIRES: x86-registered-target 5cee313d2SEric Christopher 6cee313d2SEric Christopher; RUN: opt -thinlto-bc -o %t1.bc %s 7cee313d2SEric Christopher; RUN: opt -thinlto-bc -o %t2.bc %S/Inputs/comdat.ll 8cee313d2SEric Christopher; RUN: llvm-lto2 run -save-temps -o %t3 %t1.bc %t2.bc \ 9cee313d2SEric Christopher; RUN: -r %t1.bc,lwt_fun,plx \ 10cee313d2SEric Christopher; RUN: -r %t2.bc,main,plx \ 11cee313d2SEric Christopher; RUN: -r %t2.bc,lwt_fun, 12cee313d2SEric Christopher; RUN: llvm-dis -o - %t3.1.3.import.bc | FileCheck %s 13cee313d2SEric Christopher 14*7b1d7937SAmy Huangtarget datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 15cee313d2SEric Christophertarget triple = "x86_64-pc-windows-msvc19.0.24215" 16cee313d2SEric Christopher 17cee313d2SEric Christopher; CHECK: $lwt.llvm.[[HASH:[0-9]+]] = comdat any 18cee313d2SEric Christopher$lwt = comdat any 19cee313d2SEric Christopher 20cee313d2SEric Christopher; CHECK: @lwt_aliasee = private unnamed_addr global {{.*}}, comdat($lwt.llvm.[[HASH]]) 21cee313d2SEric Christopher@lwt_aliasee = private unnamed_addr global [1 x i8*] [i8* null], comdat($lwt) 22cee313d2SEric Christopher 23cee313d2SEric Christopher; CHECK: @lwt.llvm.[[HASH]] = hidden unnamed_addr alias 24cee313d2SEric Christopher@lwt = internal unnamed_addr alias [1 x i8*], [1 x i8*]* @lwt_aliasee 25cee313d2SEric Christopher 26cee313d2SEric Christopher; Below function should get imported into other module, resulting in @lwt being 27cee313d2SEric Christopher; promoted and renamed. 28cee313d2SEric Christopherdefine i8* @lwt_fun() { 29cee313d2SEric Christopher %1 = getelementptr inbounds [1 x i8*], [1 x i8*]* @lwt, i32 0, i32 0 30cee313d2SEric Christopher %2 = load i8*, i8** %1 31cee313d2SEric Christopher ret i8* %2 32cee313d2SEric Christopher} 33