1 ; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S | FileCheck %s
3 ; This tests that the function count of two callees get correctly updated after
4 ; they have been inlined into two back-to-back callsites in a single basic block
5 ; in the caller. The callees have the alwaysinline attribute and so they get
6 ; inlined both with the regular inliner pass and the always inline pass. In
7 ; both cases, the new count of each callee is the original count minus callsite
8 ; count which is 200 (since the caller's entry count is 400 and the block
9 ; containing the calls have a relative block frequency of 0.5).
11 ; CHECK: @callee1(i32 %n) #0 !prof [[COUNT1:![0-9]+]]
12 define i32 @callee1(i32 %n) #0 !prof !1 {
13 %cond = icmp sle i32 %n, 10
14 br i1 %cond, label %cond_true, label %cond_false
24 ; CHECK: @callee2(i32 %n) #0 !prof [[COUNT2:![0-9]+]]
25 define i32 @callee2(i32 %n) #0 !prof !2 {
30 define i32 @caller(i32 %n) !prof !3 {
31 %cond = icmp sle i32 %n, 100
32 br i1 %cond, label %cond_true, label %cond_false
35 %i = call i32 @callee1(i32 %n)
36 %j = call i32 @callee2(i32 %i)
42 !llvm.module.flags = !{!0}
43 ; CHECK: [[COUNT1]] = !{!"function_entry_count", i64 800}
44 ; CHECK: [[COUNT2]] = !{!"function_entry_count", i64 1800}
45 !0 = !{i32 1, !"MaxFunctionCount", i32 1000}
46 !1 = !{!"function_entry_count", i64 1000}
47 !2 = !{!"function_entry_count", i64 2000}
48 !3 = !{!"function_entry_count", i64 400}
49 attributes #0 = { alwaysinline }