1; RUN: rm -rf %t && split-file %s %t 2; RUN: llvm-link -S %t/1.ll %t/1-aux.ll -o - | FileCheck %s 3; RUN: llvm-link -S %t/2.ll %t/2-aux.ll -o - | FileCheck %s --check-prefix=CHECK2 4 5;--- 1.ll 6$c = comdat any 7 8@v = global i32 0, comdat ($c) 9 10; CHECK: @v = global i32 0, comdat($c) 11; CHECK: @v3 = external global i32 12; CHECK: @v2 = external dllexport global i32 13 14;--- 1-aux.ll 15$c = comdat any 16 17@v2 = weak dllexport global i32 0, comdat ($c) 18define ptr @f2() { 19 ret ptr @v2 20} 21 22@v3 = weak alias i32, ptr @v2 23define ptr @f3() { 24 ret ptr @v3 25} 26 27;--- 2.ll 28;; Check that a private global variable from a non-prevailing comdat group is 29;; converted into 'available_externally' and excluded from the comdat group. 30 31; CHECK2: $__profc_foo = comdat any 32; CHECK2: @llvm.compiler.used = appending global [2 x ptr] [ptr @__profd_foo.[[SUFFIX:[0-9]+]], ptr @__profd_foo] 33; CHECK2: @__profd_foo.[[SUFFIX]] = private global ptr @__profc_foo, comdat($__profc_foo) 34; CHECK2: @__profc_foo = linkonce_odr global i64 1, comdat 35; CHECK2: @__profd_foo = available_externally dso_local global ptr @__profc_foo{{$}} 36 37$__profc_foo = comdat any 38@__profc_foo = linkonce_odr global i64 1, comdat 39@__profd_foo = private global ptr @__profc_foo, comdat($__profc_foo) 40@llvm.compiler.used = appending global [1 x ptr] [ ptr @__profd_foo ] 41 42define ptr @bar() { 43 ret ptr @__profc_foo 44} 45 46;--- 2-aux.ll 47$__profc_foo = comdat any 48@__profc_foo = linkonce_odr global i64 1, comdat 49@__profd_foo = private global ptr @__profc_foo, comdat($__profc_foo) 50@llvm.compiler.used = appending global [1 x ptr] [ ptr @__profd_foo ] 51 52define ptr @baz() { 53 ret ptr @__profc_foo 54} 55