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