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
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
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
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]
27 define void @internal() {
28 call fastcc void @external1()
29 call fastcc void @internal2()
30 call coldcc void @external_big()
34 define void @internal2() alwaysinline {
38 define void @internal3() {
39 call fastcc void @external1()
40 call fastcc void @external5()
44 declare void @external_decl()
46 define void @external1() alwaysinline !thinlto_src_module !0 {
47 call fastcc void @internal2()
48 call fastcc void @external2();
49 call void @external_decl();
53 define void @external2() alwaysinline !thinlto_src_module !1 {
57 define void @external3() alwaysinline !thinlto_src_module !1 {
61 define void @external4() !thinlto_src_module !1 {
62 call fastcc void @external1()
63 call fastcc void @external2()
67 define void @external5() !thinlto_src_module !1 {
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.
73 define 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()
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()
88 ; It should not be imported, but it should not break anything.
89 define void @external_notcalled() !thinlto_src_module !0 {
90 call void @external_notcalled()