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
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
11 ; RUN: %python %S/../../../../lib/Analysis/models/generate_mock_model.py %S/../../../../lib/Analysis/models/inlining/config.py %t
13 ; When the bounds are very wide ("no bounds"), all inlinings happen.
14 ; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%t -training-log=- -tfutils-text-log -enable-ml-inliner=development -ml-advisor-size-increase-threshold=10.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
16 ; When the bounds are very restrictive, the first inlining happens but it's
17 ; considered as "bad" (since it trips over the bounds) and its reward is a
18 ; penalty. However, the mandatory inlining, which is considered next, happens.
19 ; No other inlinings happend.
20 ; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%t -training-log=- -tfutils-text-log -enable-ml-inliner=development -ml-advisor-size-increase-threshold=1.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
22 ; With more restrictive bounds, the first inlining happens and is OK. The
23 ; mandatory inlining happens next, and it trips over the bounds, which then
24 ; forces no further inlinings.
25 ; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%t -training-log=- -tfutils-text-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
26 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
27 target triple = "x86_64-grtev4-linux-gnu"
29 define i64 @may_not_be_inlined() {
34 define i64 @must_be_inlined() #0 {
35 %r = call i64 @may_not_be_inlined()
40 %r = call i64 @must_be_inlined()
41 %r2 = call i64 @may_not_be_inlined()
42 %r3 = call i64 @may_not_be_inlined()
44 %r5 = add i64 %r3, %r4
47 attributes #0 = { alwaysinline }
48 ; CHECK: key: "delta_size"
50 ; CHECK-NEXT: feature {
51 ; CHECK-NEXT: int64_list {
52 ; NOBOUNDS-NEXT: value: 6
53 ; RELAXED-BOUNDS-NEXT: value: 6
56 ; NOBOUNDS-NEXT: feature {
57 ; NOBOUNDS-NEXT: int64_list {
58 ; NOBOUNDS-NEXT: value: -11
61 ; NOBOUNDS-NEXT: feature {
62 ; NOBOUNDS-NEXT: int64_list {
63 ; NOBOUNDS-NEXT: value: 4
64 ; BOUNDS-NEXT: value: 2147483647
67 ; must_be_inlined must always be inlined, so we won't find a call to it in @top()
68 ; CHECK-NOT: call i64 @must_be_inlined
69 ; @some-function isn't mandatory, and when we set the increase threshold too low,
70 ; it won't be inlined.
71 ; NOBOUNDS-NOT: @may_not_be_inlined
72 ; RELAXED-BOUNDS: call i64 @may_not_be_inlined
73 ; BOUNDS: call i64 @may_not_be_inlined