• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -inline-threshold=100 -inline-cold-callsite-threshold=0 -S | FileCheck %s
3
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.
7
8define void @callee() {
9  call void @extern()
10  call void @extern()
11  ret void
12}
13
14declare void @extern()
15declare i1 @ext(i32)
16
17; CHECK-LABEL: caller
18define i32 @caller(i32 %n) {
19entry:
20  %cmp4 = icmp sgt i32 %n, 0
21  br i1 %cmp4, label %for.body, label %for.cond.cleanup
22
23for.cond.cleanup:
24  ret i32 0
25
26for.body:
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
32  call void @callee()
33  br i1 %call, label %cold, label %for.inc, !prof !0
34
35cold:
36; CHECK: call void @callee
37  call void @callee()
38  br label %for.inc
39
40for.inc:
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
44}
45
46
47!0 = !{!"branch_weights", i32 1, i32 2000}
48