97 lines · plain
1; RUN: opt -S -passes=inline -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK2; RUN: opt -S -passes=inline -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes="CHECK-VERBOSE",CHECK3 4; RUN: opt -S -passes=inliner-wrapper-no-mandatory-first -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK5; RUN: opt -S -passes=inliner-wrapper-no-mandatory-first -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes="CHECK-VERBOSE",CHECK6 7; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK8; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-VERBOSE,CHECK9 10; CHECK: ------- Dumping inliner stats for [<stdin>] -------11; CHECK-BASIC-NOT: -- List of inlined functions:12; CHECK-BASIC-NOT: -- Inlined not imported function13; CHECK-VERBOSE: -- List of inlined functions:14; CHECK-VERBOSE: Inlined not imported function [internal2]: #inlines = 6, #inlines_to_importing_module = 215; CHECK-VERBOSE: Inlined imported function [external2]: #inlines = 4, #inlines_to_importing_module = 116; CHECK-VERBOSE: Inlined imported function [external1]: #inlines = 3, #inlines_to_importing_module = 217; CHECK-VERBOSE: Inlined imported function [external5]: #inlines = 1, #inlines_to_importing_module = 118; CHECK-VERBOSE: Inlined imported function [external3]: #inlines = 1, #inlines_to_importing_module = 019 20; CHECK: -- Summary:21; CHECK: All functions: 10, imported functions: 722; CHECK: inlined functions: 5 [50% of all functions]23; CHECK: imported functions inlined anywhere: 4 [57.14% of imported functions]24; CHECK: imported functions inlined into importing module: 3 [42.86% of imported functions], remaining: 4 [57.14% of imported functions]25; CHECK: non-imported functions inlined anywhere: 1 [33.33% of non-imported functions]26; CHECK: non-imported functions inlined into importing module: 1 [33.33% of non-imported functions]27 28define void @internal() {29 call fastcc void @external1()30 call fastcc void @internal2()31 call coldcc void @external_big()32 ret void33}34 35define void @internal2() alwaysinline {36 ret void37}38 39define void @internal3() {40 call fastcc void @external1()41 call fastcc void @external5()42 ret void43}44 45declare void @external_decl()46 47define void @external1() alwaysinline !thinlto_src_module !0 !thinlto_src_file !1 {48 call fastcc void @internal2()49 call fastcc void @external2();50 call void @external_decl();51 ret void52}53 54define void @external2() alwaysinline !thinlto_src_module !1 {55 ret void56}57 58define void @external3() alwaysinline !thinlto_src_module !1 {59 ret void60}61 62define void @external4() !thinlto_src_module !1 {63 call fastcc void @external1()64 call fastcc void @external2()65 ret void66}67 68define void @external5() !thinlto_src_module !1 {69 ret void70}71 72; Assume big piece of code here. This function won't be inlined, so all the73; inlined function it will have won't affect real inlines.74define void @external_big() noinline !thinlto_src_module !1 {75; CHECK-NOT: call fastcc void @internal2()76 call fastcc void @internal2()77 call fastcc void @internal2()78 call fastcc void @internal2()79 call fastcc void @internal2()80 81; CHECK-NOT: call fastcc void @external2()82 call fastcc void @external2()83 call fastcc void @external2()84; CHECK-NOT: call fastcc void @external3()85 call fastcc void @external3()86 ret void87}88 89; It should not be imported, but it should not break anything.90define void @external_notcalled() !thinlto_src_module !0 !thinlto_src_file !1 {91 call void @external_notcalled()92 ret void93}94 95!0 = !{!"file.cc"}96!1 = !{!"other.cc"}97