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
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
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
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
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
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]
33 define void @internal() {
34 call fastcc void @external1()
35 call fastcc void @internal2()
36 call coldcc void @external_big()
40 define void @internal2() alwaysinline {
44 define void @internal3() {
45 call fastcc void @external1()
46 call fastcc void @external5()
50 declare void @external_decl()
52 define void @external1() alwaysinline !thinlto_src_module !0 {
53 call fastcc void @internal2()
54 call fastcc void @external2();
55 call void @external_decl();
59 define void @external2() alwaysinline !thinlto_src_module !1 {
63 define void @external3() alwaysinline !thinlto_src_module !1 {
67 define void @external4() !thinlto_src_module !1 {
68 call fastcc void @external1()
69 call fastcc void @external2()
73 define void @external5() !thinlto_src_module !1 {
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.
79 define 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()
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()
94 ; It should not be imported, but it should not break anything.
95 define void @external_notcalled() !thinlto_src_module !0 {
96 call void @external_notcalled()