1; Test hot or unlikely section postfix based on profile and user annotation.
2; RUN: llc < %s | FileCheck %s
3target triple = "x86_64-unknown-linux-gnu"
4
5; Function Attrs: inlinehint norecurse nounwind readnone uwtable
6define dso_local i32 @hot1() #0 !prof !31 {
7entry:
8  ret i32 1
9}
10; CHECK: .section        .text.hot.,"ax",@progbits
11; CHECK: .globl  hot1
12
13; Function Attrs: cold norecurse nounwind readnone uwtable
14define dso_local i32 @cold1() #1 !prof !32 {
15entry:
16  ret i32 1
17}
18; CHECK: .section        .text.unlikely.,"ax",@progbits
19; CHECK: .globl  cold1
20
21; Function Attrs: cold inlinehint noinline norecurse nounwind optsize readnone uwtable
22define dso_local i32 @hot2() #2 !prof !31 {
23entry:
24  ret i32 1
25}
26; CHECK: .section        .text.hot.,"ax",@progbits
27; CHECK: .globl  hot2
28
29define dso_local i32 @normal() {
30entry:
31  ret i32 1
32}
33; CHECK: text
34; CHECK: .globl  normal
35
36; Function Attrs: hot noinline norecurse nounwind readnone uwtable
37define dso_local i32 @hot3() #3 !prof !32 {
38entry:
39  ret i32 1
40}
41; CHECK: .section        .text.hot.,"ax",@progbits
42; CHECK: .globl  hot3
43
44; Function Attrs: cold noinline norecurse nounwind optsize readnone uwtable
45define dso_local i32 @cold2() #4 {
46entry:
47  ret i32 1
48}
49; CHECK: .section        .text.unlikely.,"ax",@progbits
50; CHECK: .globl  cold2
51
52; Function Attrs: hot noinline norecurse nounwind readnone uwtable
53define dso_local i32 @hot4() #3 {
54entry:
55  ret i32 1
56}
57; CHECK: .section        .text.hot.,"ax",@progbits
58; CHECK: .globl  hot4
59
60attributes #0 = { inlinehint norecurse nounwind readnone uwtable }
61attributes #1 = { cold norecurse nounwind readnone uwtable }
62attributes #2 = { cold inlinehint noinline norecurse nounwind optsize readnone uwtable }
63attributes #3 = { hot noinline norecurse nounwind readnone uwtable }
64attributes #4 = { cold noinline norecurse nounwind optsize readnone uwtable }
65
66!llvm.module.flags = !{!0, !1}
67!llvm.ident = !{!30}
68
69!0 = !{i32 1, !"wchar_size", i32 4}
70!1 = !{i32 1, !"ProfileSummary", !2}
71!2 = !{!3, !4, !5, !6, !7, !8, !9, !10, !11, !12}
72!3 = !{!"ProfileFormat", !"InstrProf"}
73!4 = !{!"TotalCount", i64 402020}
74!5 = !{!"MaxCount", i64 200000}
75!6 = !{!"MaxInternalCount", i64 2000}
76!7 = !{!"MaxFunctionCount", i64 200000}
77!8 = !{!"NumCounts", i64 7}
78!9 = !{!"NumFunctions", i64 5}
79!10 = !{!"IsPartialProfile", i64 0}
80!11 = !{!"PartialProfileRatio", double 0.000000e+00}
81!12 = !{!"DetailedSummary", !13}
82!13 = !{!14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27, !28, !29}
83!14 = !{i32 10000, i64 200000, i32 1}
84!15 = !{i32 100000, i64 200000, i32 1}
85!16 = !{i32 200000, i64 200000, i32 1}
86!17 = !{i32 300000, i64 200000, i32 1}
87!18 = !{i32 400000, i64 200000, i32 1}
88!19 = !{i32 500000, i64 100000, i32 3}
89!20 = !{i32 600000, i64 100000, i32 3}
90!21 = !{i32 700000, i64 100000, i32 3}
91!22 = !{i32 800000, i64 100000, i32 3}
92!23 = !{i32 900000, i64 100000, i32 3}
93!24 = !{i32 950000, i64 100000, i32 3}
94!25 = !{i32 990000, i64 100000, i32 3}
95!26 = !{i32 999000, i64 2000, i32 4}
96!27 = !{i32 999900, i64 2000, i32 4}
97!28 = !{i32 999990, i64 10, i32 6}
98!29 = !{i32 999999, i64 10, i32 6}
99!30 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git 53c5fdd59a5cf7fbb4dcb7a7e84c9c4a40d32a84)"}
100!31 = !{!"function_entry_count", i64 100000}
101!32 = !{!"function_entry_count", i64 10}
102