brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 550d1b1 Raw
53 lines · plain
1; The goal of this test is checking if LastCallToStaticBonus is applied2; correctly while deciding inline deferral. For the test code below, when3; inliner evaluates the callsite of bar->baz, it checks if inlining of bar->baz4; prevents ininling of foo->bar, even when foo->bar inlining is more beneficial5; than bar->baz inlining. As LastCallToStaticBonus has a massive value, and6; both baz and bar has only one caller, the cost of foo->bar inlining and7; bar->baz inlining should be non-trivial for inliner to compute that bar->baz8; inlining can actaully prevent foo->bar inlining. To make the cost of these9; callsites big enough, loop unrolling pass with very high threshold is used to10; preprocess the test.11 12; RUN: opt < %s -passes='function(require<opt-remark-emit>,loop-unroll),require<profile-summary>,cgscc(inline)' -unroll-threshold=15000 -inline-threshold=250 -S | FileCheck %s13; CHECK-LABEL: define internal i32 @bar()14 15define internal i32 @baz() {16entry:17  br label %bb118 19bb1:20  %ind = phi i32 [ 0, %entry ], [ %inc, %bb1 ]21  call void @extern()22  %inc = add nsw i32 %ind, 123  %cmp = icmp sgt i32 %inc, 51024  br i1 %cmp, label %ret, label %bb125 26ret:27  ret i32 028}29 30define internal i32 @bar() {31entry:32  br label %bb133 34bb1:35  %ind = phi i32 [ 0, %entry ], [ %inc, %bb1 ]36  call void @extern()37  %inc = add nsw i32 %ind, 138  %cmp = icmp sgt i32 %inc, 51039  br i1 %cmp, label %ret, label %bb140 41ret:42  call i32 @baz()43  ret i32 044}45 46define i32 @foo() {47entry:48  call i32 @bar()49  ret i32 050}51 52declare void @extern()53