1 ; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t %s
2 ; RUN: llvm-modextract -b -n 0 -o - %t | llvm-dis | FileCheck --check-prefix=M0 %s
3 ; RUN: llvm-modextract -b -n 1 -o - %t | llvm-dis | FileCheck --check-prefix=M1 %s
5 ; M0: @g = external constant [10 x ptr]{{$}}
6 ; M1: @g = constant [10 x ptr]
7 @g = constant [10 x ptr] [
21 ; M1: define available_externally i64 @ok1
22 define i64 @ok1(ptr %this) {
27 ; M1: define available_externally i64 @ok2
28 define i64 @ok2(ptr %this, i64 %arg) {
29 %1 = tail call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %arg, i64 %arg)
33 ; M1: declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64)
34 declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64)
36 ; M0: define void @wrongtype1
37 ; M1: declare void @wrongtype1()
38 define void @wrongtype1(ptr) {
42 ; M0: define i128 @wrongtype2
43 ; M1: declare void @wrongtype2()
44 define i128 @wrongtype2(ptr) {
48 ; M0: define i64 @wrongtype3
49 ; M1: declare void @wrongtype3()
50 define i64 @wrongtype3() {
54 ; M0: define i64 @wrongtype4
55 ; M1: declare void @wrongtype4()
56 define i64 @wrongtype4(ptr, ptr) {
60 ; M0: define i64 @wrongtype5
61 ; M1: declare void @wrongtype5()
62 define i64 @wrongtype5(ptr, i128) {
66 ; M0: define i64 @usesthis
67 ; M1: declare void @usesthis()
68 define i64 @usesthis(ptr %this) {
69 %i = ptrtoint ptr %this to i64
73 ; M0: define i8 @reads
74 ; M1: declare void @reads()
75 define i8 @reads(ptr %this) {
76 %l = load i8, ptr %this
80 ; Check function attributes are copied over splitted module
81 ; M0: declare dso_local noundef ptr @attributedFunc(ptr noalias, i8 zeroext) unnamed_addr #[[ATTR0:[0-9]+]]
82 ; M1: declare dso_local void @attributedFunc() unnamed_addr #[[ATTR1:[0-9]+]]
83 declare dso_local noundef ptr @attributedFunc(ptr noalias, i8 zeroext) unnamed_addr alwaysinline willreturn
84 ; M0: attributes #[[ATTR0]] = { alwaysinline willreturn }
85 ; M1: attributes #[[ATTR1]] = { alwaysinline willreturn }
87 !0 = !{i32 0, !"typeid"}