blob: 3a985ff7b5ea340aaac72fdb8120ba59e12c9d7e [file] [log] [blame]
Wei Mi66c6c5a2018-12-13 21:51:42 +00001; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/inline.prof -codegenprepare -S | FileCheck %s
2; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/inline.prof -codegenprepare -profile-sample-accurate -S | FileCheck %s --check-prefix ACCURATE
3
4target triple = "x86_64-pc-linux-gnu"
5
6; The test checks that function without profile gets unlikely section prefix
7; if -profile-sample-accurate is specified or the function has the
8; profile-sample-accurate attribute.
9
10declare void @hot_func()
11
12; CHECK-NOT: foo_not_in_profile{{.*}}!section_prefix
13; CHECK: foo_not_in_profile{{.*}}!prof ![[UNKNOWN_ID:[0-9]+]]
14; ACCURATE: foo_not_in_profile{{.*}}!prof ![[ZERO_ID:[0-9]+]] !section_prefix ![[COLD_ID:[0-9]+]]
15; The function not appearing in profile is cold when -profile-sample-accurate
16; is on.
17define void @foo_not_in_profile() {
18 call void @hot_func()
19 ret void
20}
21
22; CHECK: bar_not_in_profile{{.*}}!prof ![[ZERO_ID:[0-9]+]] !section_prefix ![[COLD_ID:[0-9]+]]
23; ACCURATE: bar_not_in_profile{{.*}}!prof ![[ZERO_ID:[0-9]+]] !section_prefix ![[COLD_ID:[0-9]+]]
24; The function not appearing in profile is cold when the func has
25; profile-sample-accurate attribute.
26define void @bar_not_in_profile() #0 {
27 call void @hot_func()
28 ret void
29}
30
31attributes #0 = { "profile-sample-accurate" }
32
33; CHECK: ![[UNKNOWN_ID]] = !{!"function_entry_count", i64 -1}
34; CHECK: ![[ZERO_ID]] = !{!"function_entry_count", i64 0}
35; CHECK: ![[COLD_ID]] = !{!"function_section_prefix", !".unlikely"}
36; ACCURATE: ![[ZERO_ID]] = !{!"function_entry_count", i64 0}
37; ACCURATE: ![[COLD_ID]] = !{!"function_section_prefix", !".unlikely"}
38!llvm.module.flags = !{!1}
39!1 = !{i32 1, !"ProfileSummary", !2}
40!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
41!3 = !{!"ProfileFormat", !"SampleProfile"}
42!4 = !{!"TotalCount", i64 10000}
43!5 = !{!"MaxCount", i64 1000}
44!6 = !{!"MaxInternalCount", i64 1}
45!7 = !{!"MaxFunctionCount", i64 1000}
46!8 = !{!"NumCounts", i64 3}
47!9 = !{!"NumFunctions", i64 3}
48!10 = !{!"DetailedSummary", !11}
49!11 = !{!12, !13, !14}
50!12 = !{i32 10000, i64 100, i32 1}
51!13 = !{i32 999000, i64 100, i32 1}
52!14 = !{i32 999999, i64 1, i32 2}