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