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