1 ;; This test verifies 'auto' hotness threshold when profile summary is available.
4 ; RUN: rm -f %t.yaml %t.hot.yaml
5 ; RUN: opt < %s --disable-output \
6 ; RUN: --passes='inline' \
7 ; RUN: --pass-remarks-output=%t.yaml --pass-remarks-filter='inline' \
8 ; RUN: --pass-remarks-with-hotness
9 ; RUN: FileCheck %s -check-prefix=YAML-PASS < %t.yaml
10 ; RUN: FileCheck %s -check-prefix=YAML-MISS < %t.yaml
12 ;; test 'auto' threshold
13 ; RUN: opt < %s --disable-output --inline-enable-cost-benefit-analysis=0 \
14 ; RUN: --passes='module(print-profile-summary,cgscc(inline))' \
15 ; RUN: --pass-remarks-output=%t.hot.yaml --pass-remarks-filter='inline' \
16 ; RUN: --pass-remarks-with-hotness --pass-remarks-hotness-threshold=auto 2>&1 | FileCheck %s
17 ; RUN: FileCheck %s -check-prefix=YAML-PASS < %t.hot.yaml
18 ; RUN: not FileCheck %s -check-prefix=YAML-MISS < %t.hot.yaml
20 ; RUN: opt < %s --disable-output --inline-enable-cost-benefit-analysis=0 \
21 ; RUN: --passes='module(print-profile-summary,cgscc(inline))' \
22 ; RUN: --pass-remarks=inline --pass-remarks-missed=inline --pass-remarks-analysis=inline \
23 ; RUN: --pass-remarks-with-hotness --pass-remarks-hotness-threshold=auto 2>&1 | FileCheck %s -check-prefix=CHECK-RPASS
25 ; YAML-PASS: --- !Passed
26 ; YAML-PASS-NEXT: Pass: inline
27 ; YAML-PASS-NEXT: Name: Inlined
28 ; YAML-PASS-NEXT: Function: caller1
29 ; YAML-PASS-NEXT: Hotness: 400
31 ; YAML-MISS: --- !Missed
32 ; YAML-MISS-NEXT: Pass: inline
33 ; YAML-MISS-NEXT: Name: NeverInline
34 ; YAML-MISS-NEXT: Function: caller2
35 ; YAML-MISS-NEXT: Hotness: 1
37 ; CHECK-RPASS: 'callee1' inlined into 'caller1' with (cost=-30, threshold=4500) (hotness: 400)
38 ; CHECK-RPASS-NOT: 'callee2' not inlined into 'caller2' because it should never be inlined (cost=never): noinline function attribute (hotness: 1)
40 define void @callee1() !prof !20 {
46 ; Function Attrs: noinline
47 define void @callee2() noinline !prof !21 {
48 ; CHECK: callee2 :cold
53 define void @caller1() !prof !20 {
60 define void @caller2() !prof !21 {
61 ; CHECK: caller2 :cold
67 !llvm.module.flags = !{!1}
68 !20 = !{!"function_entry_count", i64 400}
69 !21 = !{!"function_entry_count", i64 1}
71 !1 = !{i32 1, !"ProfileSummary", !2}
72 !2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
73 !3 = !{!"ProfileFormat", !"InstrProf"}
74 !4 = !{!"TotalCount", i64 10000}
75 !5 = !{!"MaxCount", i64 10}
76 !6 = !{!"MaxInternalCount", i64 1}
77 !7 = !{!"MaxFunctionCount", i64 1000}
78 !8 = !{!"NumCounts", i64 3}
79 !9 = !{!"NumFunctions", i64 3}
80 !10 = !{!"DetailedSummary", !11}
81 !11 = !{!12, !13, !14}
82 !12 = !{i32 10000, i64 100, i32 1}
83 !13 = !{i32 999000, i64 100, i32 1}
84 !14 = !{i32 999999, i64 1, i32 2}