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 8 define internal i32 @baz() { 9 entry: 10 br label %bb1 11 12 bb1: 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 19 ret: 20 ret i32 0 21 } 22 23 ; CHECK-LABEL: define internal i32 @bar 24 define internal i32 @bar(i1 %b) { 25 entry: 26 br label %bb1 27 28 bb1: 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 35 for.exit: 36 br i1 %b, label %bb2, label %ret, !prof !0 37 bb2: 38 ; CHECK: call i32 @baz 39 call i32 @baz() 40 br label %ret 41 ret: 42 ret i32 0 43 } 44 ; CHECK-LABEL: define i32 @foo 45 define i32 @foo(i1 %b) { 46 entry: 47 br i1 %b, label %bb1, label %ret, !prof !0 48 bb1: 49 ; CHECK: call i32 @bar 50 call i32 @bar(i1 %b) 51 br label %ret 52 ret: 53 ret i32 0 54 } 55 56 declare void @extern() 57 58 !0 = !{!"branch_weights", i32 1, i32 2500} 59