• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1;; This test verifies 'auto' hotness threshold when profile summary is available.
2;;
3;; new PM
4; RUN: rm -f %t.yaml %t.hot.yaml
5; RUN: opt < %s --disable-output --enable-new-pm \
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
11
12;; test 'auto' threshold
13; RUN: opt < %s --disable-output --enable-new-pm \
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
19
20; RUN: opt < %s --disable-output --enable-new-pm \
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
24
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
30
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
36
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)
39
40define void @callee1() !prof !20 {
41; CHECK: callee1 :hot
42entry:
43  ret void
44}
45
46; Function Attrs: noinline
47define void @callee2() noinline !prof !21 {
48; CHECK: callee2 :cold
49entry:
50  ret void
51}
52
53define void @caller1() !prof !20 {
54; CHECK: caller1 :hot
55entry:
56  call void @callee1()
57  ret void
58}
59
60define void @caller2() !prof !21 {
61; CHECK: caller2 :cold
62entry:
63  call void @callee2()
64  ret void
65}
66
67!llvm.module.flags = !{!1}
68!20 = !{!"function_entry_count", i64 400}
69!21 = !{!"function_entry_count", i64 1}
70
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}
85
86