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() {
14 declare void @extern()
18 define i32 @caller(i32 %n) {
20 %cmp4 = icmp sgt i32 %n, 0
21 br i1 %cmp4, label %for.body, label %for.cond.cleanup
27 %i.05 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
28 ; CHECK: %call = tail call
29 %call = tail call zeroext i1 @ext(i32 %i.05)
30 ; CHECK-NOT: call void @callee
31 ; CHECK-NEXT: call void @extern
33 br i1 %call, label %cold, label %for.inc, !prof !0
36 ; CHECK: call void @callee
41 %inc = add nuw nsw i32 %i.05, 1
42 %exitcond = icmp eq i32 %inc, %n
43 br i1 %exitcond, label %for.cond.cleanup, label %for.body
47 !0 = !{!"branch_weights", i32 1, i32 2000}