51 lines · plain
1; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S | FileCheck %s2 3; This tests that the function count of two callees get correctly updated after4; they have been inlined into two back-to-back callsites in a single basic block5; in the caller. The callees have the alwaysinline attribute and so they get6; inlined both with the regular inliner pass and the always inline pass. In7; both cases, the new count of each callee is the original count minus callsite8; count which is 200 (since the caller's entry count is 400 and the block9; containing the calls have a relative block frequency of 0.5).10 11; CHECK: @callee1(i32 %n) #0 !prof [[COUNT1:![0-9]+]]12define i32 @callee1(i32 %n) #0 !prof !1 {13 %cond = icmp sle i32 %n, 1014 br i1 %cond, label %cond_true, label %cond_false15 16cond_true:17 %r1 = add i32 %n, 118 ret i32 %r119cond_false:20 %r2 = add i32 %n, 221 ret i32 %r222}23 24; CHECK: @callee2(i32 %n) #0 !prof [[COUNT2:![0-9]+]]25define i32 @callee2(i32 %n) #0 !prof !2 {26 %r1 = add i32 %n, 127 ret i32 %r128}29 30define i32 @caller(i32 %n) !prof !3 {31 %cond = icmp sle i32 %n, 10032 br i1 %cond, label %cond_true, label %cond_false33 34cond_true:35 %i = call i32 @callee1(i32 %n)36 %j = call i32 @callee2(i32 %i)37 ret i32 %j38cond_false:39 ret i32 040}41 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}49attributes #0 = { alwaysinline }50 51