1 ; This tests that a hot callsite gets the (higher) inlinehint-threshold even without
2 ; without inline hints and gets inlined because the cost is less than
3 ; inlinehint-threshold. A cold callee with identical body does not get inlined because
4 ; cost exceeds the inline-threshold
6 ; RUN: opt < %s -inline -inline-threshold=0 -hot-callsite-threshold=100 -S -enable-new-pm=0 | FileCheck %s
7 ; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
9 ; Run this with the default O2 pipeline to test that profile summary analysis
10 ; is available during inlining.
11 ; RUN: opt < %s -passes='default<O2>' -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
13 define i32 @callee1(i32 %x) {
22 define i32 @callee2(i32 %x) {
23 ; CHECK-LABEL: @callee2(
32 define i32 @caller2(i32 %y1) {
33 ; CHECK-LABEL: @caller2(
34 ; CHECK: call i32 @callee2
35 ; CHECK-NOT: call i32 @callee1
36 ; CHECK: ret i32 %x3.i
37 %y2 = call i32 @callee2(i32 %y1), !prof !22
38 %y3 = call i32 @callee1(i32 %y2), !prof !21
42 declare i32 @__gxx_personality_v0(...)
44 define i32 @invoker2(i32 %y1) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
45 ; CHECK-LABEL: @invoker2(
46 ; CHECK: invoke i32 @callee2
47 ; CHECK-NOT: invoke i32 @callee1
49 %y2 = invoke i32 @callee2(i32 %y1) to label %next unwind label %lpad, !prof !22
52 %y3 = invoke i32 @callee1(i32 %y2) to label %exit unwind label %lpad, !prof !21
58 %ll = landingpad { i8*, i32 } cleanup
62 define i32 @invoker3(i32 %y1) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
63 ; CHECK-LABEL: @invoker3(
64 ; CHECK: invoke i32 @callee2
65 ; CHECK-NOT: invoke i32 @callee1
67 %y2 = invoke i32 @callee2(i32 %y1) to label %next unwind label %lpad,
68 !prof !{!"branch_weights", i64 1, i64 0}
71 %y3 = invoke i32 @callee1(i32 %y2) to label %exit unwind label %lpad,
72 !prof !{!"branch_weights", i64 300, i64 1}
78 %ll = landingpad { i8*, i32 } cleanup
82 define i32 @invoker4(i32 %y1) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
83 ; CHECK-LABEL: @invoker4(
84 ; CHECK: invoke i32 @callee2
85 ; CHECK-NOT: invoke i32 @callee1
87 %y2 = invoke i32 @callee2(i32 %y1) to label %next unwind label %lpad,
88 !prof !{!"branch_weights", i64 1, i64 0}
91 %y3 = invoke i32 @callee1(i32 %y2) to label %exit unwind label %lpad,
92 !prof !{!"branch_weights", i64 0, i64 300}
98 %ll = landingpad { i8*, i32 } cleanup
102 declare void @extern()
104 !llvm.module.flags = !{!1}
105 !21 = !{!"branch_weights", i64 300}
106 !22 = !{!"branch_weights", i64 1}
108 !1 = !{i32 1, !"ProfileSummary", !2}
109 !2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
110 !3 = !{!"ProfileFormat", !"SampleProfile"}
111 !4 = !{!"TotalCount", i64 10000}
112 !5 = !{!"MaxCount", i64 1000}
113 !6 = !{!"MaxInternalCount", i64 1}
114 !7 = !{!"MaxFunctionCount", i64 1000}
115 !8 = !{!"NumCounts", i64 3}
116 !9 = !{!"NumFunctions", i64 3}
117 !10 = !{!"DetailedSummary", !11}
118 !11 = !{!12, !13, !14}
119 !12 = !{i32 10000, i64 100, i32 1}
120 !13 = !{i32 999000, i64 100, i32 1}
121 !14 = !{i32 999999, i64 1, i32 2}