1 ; RUN: opt -S -passes=inline -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK
2 ; RUN: opt -S -passes=inline -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes="CHECK-VERBOSE",CHECK
4 ; RUN: opt -S -passes=inliner-wrapper-no-mandatory-first -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK
5 ; RUN: opt -S -passes=inliner-wrapper-no-mandatory-first -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes="CHECK-VERBOSE",CHECK
7 ; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK
8 ; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-VERBOSE,CHECK
10 ; CHECK: ------- Dumping inliner stats for [<stdin>] -------
11 ; CHECK-BASIC-NOT: -- List of inlined functions:
12 ; CHECK-BASIC-NOT: -- Inlined not imported function
13 ; CHECK-VERBOSE: -- List of inlined functions:
14 ; CHECK-VERBOSE: Inlined not imported function [internal2]: #inlines = 6, #inlines_to_importing_module = 2
15 ; CHECK-VERBOSE: Inlined imported function [external2]: #inlines = 4, #inlines_to_importing_module = 1
16 ; CHECK-VERBOSE: Inlined imported function [external1]: #inlines = 3, #inlines_to_importing_module = 2
17 ; CHECK-VERBOSE: Inlined imported function [external5]: #inlines = 1, #inlines_to_importing_module = 1
18 ; CHECK-VERBOSE: Inlined imported function [external3]: #inlines = 1, #inlines_to_importing_module = 0
21 ; CHECK: All functions: 10, imported functions: 7
22 ; 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]
28 define void @internal() {
29 call fastcc void @external1()
30 call fastcc void @internal2()
31 call coldcc void @external_big()
35 define void @internal2() alwaysinline {
39 define void @internal3() {
40 call fastcc void @external1()
41 call fastcc void @external5()
45 declare void @external_decl()
47 define void @external1() alwaysinline !thinlto_src_module !0 {
48 call fastcc void @internal2()
49 call fastcc void @external2();
50 call void @external_decl();
54 define void @external2() alwaysinline !thinlto_src_module !1 {
58 define void @external3() alwaysinline !thinlto_src_module !1 {
62 define void @external4() !thinlto_src_module !1 {
63 call fastcc void @external1()
64 call fastcc void @external2()
68 define void @external5() !thinlto_src_module !1 {
72 ; Assume big piece of code here. This function won't be inlined, so all the
73 ; inlined function it will have won't affect real inlines.
74 define 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()
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()
89 ; It should not be imported, but it should not break anything.
90 define void @external_notcalled() !thinlto_src_module !0 {
91 call void @external_notcalled()