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