16699029bSArthur Eubanks; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t %s 2cee313d2SEric Christopher; RUN: llvm-modextract -b -n 0 -o - %t | llvm-dis | FileCheck --check-prefix=M0 %s 3cee313d2SEric Christopher; RUN: llvm-modextract -b -n 1 -o - %t | llvm-dis | FileCheck --check-prefix=M1 %s 4cee313d2SEric Christopher 5*e28435caSZequan Wu; M0: @g = external constant [10 x i8*]{{$}} 6*e28435caSZequan Wu; M1: @g = constant [10 x i8*] 7*e28435caSZequan Wu@g = constant [10 x i8*] [ 8cee313d2SEric Christopher i8* bitcast (i64 (i8*)* @ok1 to i8*), 9cee313d2SEric Christopher i8* bitcast (i64 (i8*, i64)* @ok2 to i8*), 10cee313d2SEric Christopher i8* bitcast (void (i8*)* @wrongtype1 to i8*), 11cee313d2SEric Christopher i8* bitcast (i128 (i8*)* @wrongtype2 to i8*), 12cee313d2SEric Christopher i8* bitcast (i64 ()* @wrongtype3 to i8*), 13cee313d2SEric Christopher i8* bitcast (i64 (i8*, i8*)* @wrongtype4 to i8*), 14cee313d2SEric Christopher i8* bitcast (i64 (i8*, i128)* @wrongtype5 to i8*), 15cee313d2SEric Christopher i8* bitcast (i64 (i8*)* @usesthis to i8*), 16*e28435caSZequan Wu i8* bitcast (i8 (i8*)* @reads to i8*), 17*e28435caSZequan Wu i8* bitcast (i8* (i8*, i8)* @attributedFunc to i8*) 18cee313d2SEric Christopher], !type !0 19cee313d2SEric Christopher 20cee313d2SEric Christopher; M0: define i64 @ok1 21cee313d2SEric Christopher; M1: define available_externally i64 @ok1 22cee313d2SEric Christopherdefine i64 @ok1(i8* %this) { 23cee313d2SEric Christopher ret i64 42 24cee313d2SEric Christopher} 25cee313d2SEric Christopher 26cee313d2SEric Christopher; M0: define i64 @ok2 27cee313d2SEric Christopher; M1: define available_externally i64 @ok2 28cee313d2SEric Christopherdefine i64 @ok2(i8* %this, i64 %arg) { 29cee313d2SEric Christopher %1 = tail call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %arg, i64 %arg) 30cee313d2SEric Christopher ret i64 %arg 31cee313d2SEric Christopher} 32cee313d2SEric Christopher 33cee313d2SEric Christopher; M1: declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64) 34cee313d2SEric Christopherdeclare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64) 35cee313d2SEric Christopher 36cee313d2SEric Christopher; M0: define void @wrongtype1 37cee313d2SEric Christopher; M1: declare void @wrongtype1() 38cee313d2SEric Christopherdefine void @wrongtype1(i8*) { 39cee313d2SEric Christopher ret void 40cee313d2SEric Christopher} 41cee313d2SEric Christopher 42cee313d2SEric Christopher; M0: define i128 @wrongtype2 43cee313d2SEric Christopher; M1: declare void @wrongtype2() 44cee313d2SEric Christopherdefine i128 @wrongtype2(i8*) { 45cee313d2SEric Christopher ret i128 0 46cee313d2SEric Christopher} 47cee313d2SEric Christopher 48cee313d2SEric Christopher; M0: define i64 @wrongtype3 49cee313d2SEric Christopher; M1: declare void @wrongtype3() 50cee313d2SEric Christopherdefine i64 @wrongtype3() { 51cee313d2SEric Christopher ret i64 0 52cee313d2SEric Christopher} 53cee313d2SEric Christopher 54cee313d2SEric Christopher; M0: define i64 @wrongtype4 55cee313d2SEric Christopher; M1: declare void @wrongtype4() 56cee313d2SEric Christopherdefine i64 @wrongtype4(i8*, i8*) { 57cee313d2SEric Christopher ret i64 0 58cee313d2SEric Christopher} 59cee313d2SEric Christopher 60cee313d2SEric Christopher; M0: define i64 @wrongtype5 61cee313d2SEric Christopher; M1: declare void @wrongtype5() 62cee313d2SEric Christopherdefine i64 @wrongtype5(i8*, i128) { 63cee313d2SEric Christopher ret i64 0 64cee313d2SEric Christopher} 65cee313d2SEric Christopher 66cee313d2SEric Christopher; M0: define i64 @usesthis 67cee313d2SEric Christopher; M1: declare void @usesthis() 68cee313d2SEric Christopherdefine i64 @usesthis(i8* %this) { 69cee313d2SEric Christopher %i = ptrtoint i8* %this to i64 70cee313d2SEric Christopher ret i64 %i 71cee313d2SEric Christopher} 72cee313d2SEric Christopher 73cee313d2SEric Christopher; M0: define i8 @reads 74cee313d2SEric Christopher; M1: declare void @reads() 75cee313d2SEric Christopherdefine i8 @reads(i8* %this) { 76cee313d2SEric Christopher %l = load i8, i8* %this 77cee313d2SEric Christopher ret i8 %l 78cee313d2SEric Christopher} 79cee313d2SEric Christopher 80*e28435caSZequan Wu; Check function attributes are copied over splitted module 81*e28435caSZequan Wu; M0: declare dso_local noundef i8* @attributedFunc(i8* noalias, i8 zeroext) unnamed_addr #[[ATTR0:[0-9]+]] 82*e28435caSZequan Wu; M1: declare dso_local void @attributedFunc() unnamed_addr #[[ATTR1:[0-9]+]] 83*e28435caSZequan Wudeclare dso_local noundef i8* @attributedFunc(i8* noalias, i8 zeroext) unnamed_addr alwaysinline willreturn 84*e28435caSZequan Wu; M0: attributes #[[ATTR0]] = { alwaysinline willreturn } 85*e28435caSZequan Wu; M1: attributes #[[ATTR1]] = { alwaysinline willreturn } 86*e28435caSZequan Wu 87cee313d2SEric Christopher!0 = !{i32 0, !"typeid"} 88