1; RUN: opt -S -inline -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=CHECK-BASIC -check-prefix=CHECK 2; RUN: opt -S -inline -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix="CHECK-VERBOSE" -check-prefix=CHECK 3 4; CHECK: ------- Dumping inliner stats for [<stdin>] ------- 5; CHECK-BASIC-NOT: -- List of inlined functions: 6; CHECK-BASIC-NOT: -- Inlined not imported function 7; CHECK-VERBOSE: -- List of inlined functions: 8; CHECK-VERBOSE: Inlined not imported function [internal2]: #inlines = 6, #inlines_to_importing_module = 2 9; CHECK-VERBOSE: Inlined imported function [external2]: #inlines = 4, #inlines_to_importing_module = 1 10; CHECK-VERBOSE: Inlined imported function [external1]: #inlines = 3, #inlines_to_importing_module = 2 11; CHECK-VERBOSE: Inlined imported function [external5]: #inlines = 1, #inlines_to_importing_module = 1 12; CHECK-VERBOSE: Inlined imported function [external3]: #inlines = 1, #inlines_to_importing_module = 0 13 14; CHECK: -- Summary: 15; CHECK: All functions: 10, imported functions: 7 16; CHECK: inlined functions: 5 [50% of all functions] 17; CHECK: imported functions inlined anywhere: 4 [57.14% of imported functions] 18; CHECK: imported functions inlined into importing module: 3 [42.86% of imported functions], remaining: 4 [57.14% of imported functions] 19; CHECK: non-imported functions inlined anywhere: 1 [33.33% of non-imported functions] 20; CHECK: non-imported functions inlined into importing module: 1 [33.33% of non-imported functions] 21 22define void @internal() { 23 call fastcc void @external1() 24 call fastcc void @internal2() 25 call coldcc void @external_big() 26 ret void 27} 28 29define void @internal2() alwaysinline { 30 ret void 31} 32 33define void @internal3() { 34 call fastcc void @external1() 35 call fastcc void @external5() 36 ret void 37} 38 39define void @external1() alwaysinline !thinlto_src_module !0 { 40 call fastcc void @internal2() 41 call fastcc void @external2(); 42 ret void 43} 44 45define void @external2() alwaysinline !thinlto_src_module !1 { 46 ret void 47} 48 49define void @external3() alwaysinline !thinlto_src_module !1 { 50 ret void 51} 52 53define void @external4() !thinlto_src_module !1 { 54 call fastcc void @external1() 55 call fastcc void @external2() 56 ret void 57} 58 59define void @external5() !thinlto_src_module !1 { 60 ret void 61} 62 63; Assume big piece of code here. This function won't be inlined, so all the 64; inlined function it will have won't affect real inlines. 65define void @external_big() noinline !thinlto_src_module !1 { 66; CHECK-NOT: call fastcc void @internal2() 67 call fastcc void @internal2() 68 call fastcc void @internal2() 69 call fastcc void @internal2() 70 call fastcc void @internal2() 71 72; CHECK-NOT: call fastcc void @external2() 73 call fastcc void @external2() 74 call fastcc void @external2() 75; CHECK-NOT: call fastcc void @external3() 76 call fastcc void @external3() 77 ret void 78} 79 80; It should not be imported, but it should not break anything. 81define void @external_notcalled() !thinlto_src_module !0 { 82 call void @external_notcalled() 83 ret void 84} 85 86!0 = !{!"file.cc"} 87!1 = !{!"other.cc"} 88