1 ; The goal of this test is checking if LastCallToStaticBonus is applied
2 ; correctly while deciding inline deferral. For the test code below, when
3 ; inliner evaluates the callsite of bar->baz, it checks if inlining of bar->baz
4 ; prevents ininling of foo->bar, even when foo->bar inlining is more beneficial
5 ; than bar->baz inlining. As LastCallToStaticBonus has a massive value, and
6 ; both baz and bar has only one caller, the cost of foo->bar inlining and
7 ; bar->baz inlining should be non-trivial for inliner to compute that bar->baz
8 ; inlining can actaully prevent foo->bar inlining. To make the cost of these
9 ; callsites big enough, loop unrolling pass with very high threshold is used to
10 ; preprocess the test.
12 ; RUN: opt < %s -loop-unroll -inline -unroll-threshold=15000 -inline-threshold=250 -S | FileCheck %s
13 ; RUN: opt < %s -passes='function(require<opt-remark-emit>,unroll),require<profile-summary>,cgscc(inline)' -unroll-threshold=15000 -inline-threshold=250 -S | FileCheck %s
14 ; CHECK-LABEL: define internal i32 @bar()
16 define internal i32 @baz() {
21 %ind = phi i32 [ 0, %entry ], [ %inc, %bb1 ]
23 %inc = add nsw i32 %ind, 1
24 %cmp = icmp sgt i32 %inc, 510
25 br i1 %cmp, label %ret, label %bb1
31 define internal i32 @bar() {
36 %ind = phi i32 [ 0, %entry ], [ %inc, %bb1 ]
38 %inc = add nsw i32 %ind, 1
39 %cmp = icmp sgt i32 %inc, 510
40 br i1 %cmp, label %ret, label %bb1
53 declare void @extern()