xref: /llvm-project/llvm/test/Linker/comdat-nodeduplicate.ll (revision 01152626ab87c6a9e76207a4a77b86a8a4ce6bbd)
1; RUN: rm -rf %t && split-file %s %t
2; RUN: not llvm-link -S %t/1.ll %t/1-aux.ll 2>&1 | FileCheck %s
3
4; CHECK: Linking globals named 'foo': symbol multiply defined!
5
6; RUN: llvm-link -S %t/2.ll %t/2-aux.ll | FileCheck %s --check-prefix=CHECK2
7; RUN: llvm-link -S %t/2-aux.ll %t/2.ll | FileCheck %s --check-prefix=CHECK2
8
9; CHECK2-DAG: @[[#]] = private global i64 0, section "data", comdat($foo)
10; CHECK2-DAG: @[[#]] = private global i64 0, section "cnts", comdat($foo)
11; CHECK2-DAG: @foo = hidden global i64 2, section "data", comdat, align 8
12; CHECK2-DAG: @bar = dso_local global i64 3, section "cnts", comdat($foo), align 16
13; CHECK2-DAG: @qux = weak_odr global i64 4, comdat($foo)
14; CHECK2-DAG: @fred = linkonce global i64 5, comdat($foo)
15
16; RUN: llvm-link -S %t/non-var.ll %t/non-var.ll 2>&1 | FileCheck %s --check-prefix=NONVAR
17
18; NONVAR: linking 'foo': non-variables in comdat nodeduplicate are not handled
19
20;--- 1.ll
21$foo = comdat nodeduplicate
22@foo = global i64 43, comdat($foo)
23
24;--- 1-aux.ll
25$foo = comdat nodeduplicate
26@foo = global i64 43, comdat($foo)
27
28;--- 2.ll
29$foo = comdat nodeduplicate
30@foo = global i64 2, section "data", comdat($foo), align 8
31@bar = weak global i64 0, section "cnts", comdat($foo)
32@qux = weak_odr global i64 4, comdat($foo)
33
34;--- 2-aux.ll
35$foo = comdat nodeduplicate
36@foo = weak hidden global i64 0, section "data", comdat($foo)
37@bar = dso_local global i64 3, section "cnts", comdat($foo), align 16
38@fred = linkonce global i64 5, comdat($foo)
39
40;--- non-var.ll
41$foo = comdat nodeduplicate
42define weak void @foo() comdat {
43  ret void
44}
45