2 ; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -inline-threshold=100 -inline-cold-callsite-threshold=0 -S | FileCheck %s
4 ; This tests that a cold callsite gets the inline-cold-callsite-threshold
5 ; and does not get inlined. Another callsite to an identical callee that
6 ; is not cold gets inlined because cost is below the inline-threshold.
8 define void @callee() "function-inline-cost"="10" {
13 declare void @extern()
17 define i32 @caller(i32 %n) {
19 %cmp4 = icmp sgt i32 %n, 0
20 br i1 %cmp4, label %for.body, label %for.cond.cleanup
26 %i.05 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
27 ; CHECK: %call = tail call
28 %call = tail call zeroext i1 @ext(i32 %i.05)
29 ; CHECK-NOT: call void @callee
30 ; CHECK-NEXT: call void @extern
32 br i1 %call, label %cold, label %for.inc, !prof !0
35 ; CHECK: call void @callee
40 %inc = add nuw nsw i32 %i.05, 1
41 %exitcond = icmp eq i32 %inc, %n
42 br i1 %exitcond, label %for.cond.cleanup, label %for.body
46 !0 = !{!"branch_weights", i32 1, i32 2000}