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. 11 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() 15 16define internal i32 @baz() { 17entry: 18 br label %bb1 19 20bb1: 21 %ind = phi i32 [ 0, %entry ], [ %inc, %bb1 ] 22 call void @extern() 23 %inc = add nsw i32 %ind, 1 24 %cmp = icmp sgt i32 %inc, 510 25 br i1 %cmp, label %ret, label %bb1 26 27ret: 28 ret i32 0 29} 30 31define internal i32 @bar() { 32entry: 33 br label %bb1 34 35bb1: 36 %ind = phi i32 [ 0, %entry ], [ %inc, %bb1 ] 37 call void @extern() 38 %inc = add nsw i32 %ind, 1 39 %cmp = icmp sgt i32 %inc, 510 40 br i1 %cmp, label %ret, label %bb1 41 42ret: 43 call i32 @baz() 44 ret i32 0 45} 46 47define i32 @foo() { 48entry: 49 call i32 @bar() 50 ret i32 0 51} 52 53declare void @extern() 54