1; This code is virtually identical to last-call-bonus.ll, but the callsites 2; to the internal functions are cold, thereby preventing the last call to 3; static bonus from being applied. 4 5; RUN: opt < %s -passes='function(require<opt-remark-emit>,unroll),require<profile-summary>,cgscc(inline)' -unroll-threshold=15000 -inline-threshold=250 -S | FileCheck %s 6 7; CHECK-LABEL: define internal i32 @baz 8define internal i32 @baz() { 9entry: 10 br label %bb1 11 12bb1: 13 %ind = phi i32 [ 0, %entry ], [ %inc, %bb1 ] 14 call void @extern() 15 %inc = add nsw i32 %ind, 1 16 %cmp = icmp sgt i32 %inc, 510 17 br i1 %cmp, label %ret, label %bb1 18 19ret: 20 ret i32 0 21} 22 23; CHECK-LABEL: define internal i32 @bar 24define internal i32 @bar(i1 %b) { 25entry: 26 br label %bb1 27 28bb1: 29 %ind = phi i32 [ 0, %entry ], [ %inc, %bb1 ] 30 call void @extern() 31 %inc = add nsw i32 %ind, 1 32 %cmp = icmp sgt i32 %inc, 510 33 br i1 %cmp, label %for.exit, label %bb1 34 35for.exit: 36 br i1 %b, label %bb2, label %ret, !prof !0 37bb2: 38; CHECK: call i32 @baz 39 call i32 @baz() 40 br label %ret 41ret: 42 ret i32 0 43} 44; CHECK-LABEL: define i32 @foo 45define i32 @foo(i1 %b) { 46entry: 47 br i1 %b, label %bb1, label %ret, !prof !0 48bb1: 49; CHECK: call i32 @bar 50 call i32 @bar(i1 %b) 51 br label %ret 52ret: 53 ret i32 0 54} 55 56declare void @extern() 57 58!0 = !{!"branch_weights", i32 1, i32 2500} 59