xref: /llvm-project/llvm/test/Transforms/ThinLTOBitcodeWriter/split-used.ll (revision 9950ea66203849df25352b8db8f4ea108ef47a5a)
1; Test to ensure that @llvm[.compiler].used is cloned to the split module for
2; any globals whose defs were cloned to that module.
3
4; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t %s
5; RUN: llvm-modextract -b -n 0 -o %t0.bc %t
6; RUN: llvm-modextract -b -n 1 -o %t1.bc %t
7; RUN: llvm-dis -o - %t0.bc | FileCheck --check-prefix=M0 %s
8; RUN: llvm-dis -o - %t1.bc | FileCheck --check-prefix=M1 %s
9
10; M0: @g1 = external global i8
11; M0: @g2 = external global i8
12; M0: @g3 = global i8 42
13; M0: @g4 = global i8 42
14; M1: @g1 = global i8 42, !type !0
15; M1: @g2 = global i8 42, !type !0
16; M1-NOT: @g
17@g1 = global i8 42, !type !0
18@g2 = global i8 42, !type !0
19@g3 = global i8 42
20@g4 = global i8 42
21
22; M0: @llvm.used = appending global [2 x ptr] [ptr @g1, ptr @g3]
23; M0: @llvm.compiler.used = appending global [2 x ptr] [ptr @g2, ptr @g4]
24; M1: @llvm.used = appending global [1 x ptr] [ptr @g1]
25; M1: @llvm.compiler.used = appending global [1 x ptr] [ptr @g2]
26@llvm.used = appending global [2 x ptr] [ ptr @g1, ptr @g3]
27@llvm.compiler.used = appending global [2 x ptr] [ ptr @g2, ptr @g4]
28
29; M1: !0 = !{i32 0, !"typeid"}
30!0 = !{i32 0, !"typeid"}
31