1; Test behavior when inlining policy grows size out of control.
2; In all cases, the end result is the same: mandatory inlinings must happen.
3; Also in all cases, we don't record the mandatory inlining (there's nothing to
4; learn from it).
5; However, when we discover we 'trip' over the artificially-low size increase
6; factor, we penalize the 'bad' decision.
7; REQUIRES: have_tf_api
8;
9; When the bounds are very wide ("no bounds"), all inlinings happen.
10; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%S/../../../../lib/Analysis/models/inliner -training-log=- -enable-ml-inliner=development -ml-advisor-size-increase-threshold=10.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
11;
12; When the bounds are very restrictive, the first inlining happens but it's
13; considered as "bad" (since it trips over the bounds) and its reward is a
14; penalty. However, the mandatory inlining, which is considered next, happens.
15; No other inlinings happend.
16; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%S/../../../../lib/Analysis/models/inliner -training-log=- -enable-ml-inliner=development -ml-advisor-size-increase-threshold=1.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
17;
18; With more restrictive bounds, the first inlining happens and is OK. The
19; mandatory inlining happens next, and it trips over the bounds, which then
20; forces no further inlinings.
21; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%S/../../../../lib/Analysis/models/inliner -training-log=- -enable-ml-inliner=development -ml-advisor-size-increase-threshold=1.1 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=RELAXED-BOUNDS
22
23target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
24target triple = "x86_64-grtev4-linux-gnu"
25
26declare i64 @f1()
27
28define i64 @may_not_be_inlined() {
29  %r = call i64 @f1()
30  %r2 = add i64 13, %r
31  ret i64 %r2
32}
33
34define i64 @must_be_inlined() #0 {
35  %r = call i64 @may_not_be_inlined()
36  %r2 = add i64 13, %r
37  ret i64 %r2
38}
39
40define i64 @top() {
41  %r = call i64 @must_be_inlined()
42  %r2 = call i64 @may_not_be_inlined()
43  %r3 = call i64 @may_not_be_inlined()
44  %r4 = add i64 %r, %r2
45  %r5 = add i64 %r3, %r4
46  ret i64 %r5
47}
48
49attributes #0 = { alwaysinline }
50; CHECK: key: "delta_size" value: {
51; NOBOUNDS-NEXT: feature: { int64_list: { value: [6] } }
52; RELAXED-BOUNDS-NEXT: feature: { int64_list: { value: [6] } }
53; NOBOUNDS-NEXT: feature: { int64_list: { value: [-11] } }
54; NOBOUNDS-NEXT: feature: { int64_list: { value: [4] } }
55; BOUNDS-NEXT: feature: { int64_list: { value: [2147483647] } }
56; CHECK-NEXT: }
57; CHECK-LABEL: @top
58; must_be_inlined must always be inlined, so we won't find a call to it in @top()
59; CHECK-NOT: call i64 @must_be_inlined
60; @some-function isn't mandatory, and when we set the increase threshold too low,
61; it won't be inlined.
62; NOBOUNDS-NOT: @may_not_be_inlined
63; RELAXED-BOUNDS: call i64 @may_not_be_inlined
64; BOUNDS: call i64 @may_not_be_inlined