1; Do setup work for all below tests: generate bitcode and combined index
2; RUN: opt -module-summary %s -o %t.bc
3; RUN: opt -module-summary %p/Inputs/funcimport_comdat.ll -o %t2.bc
4; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc
5
6; Ensure linking of comdat containing external linkage global and function
7; removes the imported available_externally defs from comdat.
8; RUN: llvm-link %t2.bc -summary-index=%t3.thinlto.bc -import=comdat1_func1:%t.bc -S | FileCheck %s --check-prefix=IMPORTCOMDAT
9; IMPORTCOMDAT-NOT: $comdat1 = comdat any
10; IMPORTCOMDAT-NOT: comdat($comdat1)
11
12; Ensure linking of comdat containing internal linkage function with alias
13; removes the imported and promoted available_externally defs from comdat.
14; RUN: llvm-link %t2.bc -summary-index=%t3.thinlto.bc -import=comdat2_func1:%t.bc -S | FileCheck %s --check-prefix=IMPORTCOMDAT2
15; IMPORTCOMDAT2-NOT: $comdat2 = comdat any
16; IMPORTCOMDAT2-NOT: comdat($comdat2)
17
18$comdat1 = comdat any
19@comdat1_glob = global i32 0, comdat($comdat1)
20define void @comdat1_func1() comdat($comdat1) {
21  ret void
22}
23
24$comdat2 = comdat any
25@comdat2_alias = alias void (), void ()* @comdat2_func1
26define internal void @comdat2_func1() comdat($comdat2) {
27  ret void
28}
29