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_tflite
11 ; RUN: rm -rf %t_savedmodel
12 ; RUN: %python %S/../../../../lib/Analysis/models/gen-inline-oz-test-model.py %t_savedmodel
13 ; RUN: %python %S/../../../../lib/Analysis/models/saved-model-to-tflite.py %t_savedmodel %t
15 ; When the bounds are very wide ("no bounds"), all inlinings happen.
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=%t -training-log=%t1 -enable-ml-inliner=development -ml-advisor-size-increase-threshold=10.0 -S < %s | FileCheck %s --check-prefixes=NOBOUNDS-OUT,CHECK
17 ; RUN: %python %S/../../../../lib/Analysis/models/log_reader.py %t1 | FileCheck %s --check-prefix=NOBOUNDS
19 ; When the bounds are very restrictive, the first inlining happens but it's
20 ; considered as "bad" (since it trips over the bounds) and its reward is a
21 ; penalty. However, the mandatory inlining, which is considered next, happens.
22 ; No other inlinings happend.
23 ; 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=%t2 -enable-ml-inliner=development -ml-advisor-size-increase-threshold=1.0 -S < %s | FileCheck %s --check-prefixes=BOUNDS-OUT,CHECK
24 ; RUN: %python %S/../../../../lib/Analysis/models/log_reader.py %t2 | FileCheck %s --check-prefix=BOUNDS
26 ; With more restrictive bounds, the first inlining happens and is OK. The
27 ; mandatory inlining happens next, and it trips over the bounds, which then
28 ; forces no further inlinings.
29 ; 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=%t3 -enable-ml-inliner=development -ml-advisor-size-increase-threshold=1.1 -S < %s | FileCheck %s --check-prefixes=RELAXED-BOUNDS-OUT,CHECK
30 ; RUN: %python %S/../../../../lib/Analysis/models/log_reader.py %t3 | FileCheck %s --check-prefix=RELAXED-BOUNDS
32 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
33 target triple = "x86_64-grtev4-linux-gnu"
35 define i64 @may_not_be_inlined() {
40 define i64 @must_be_inlined() #0 {
41 %r = call i64 @may_not_be_inlined()
46 %r = call i64 @must_be_inlined()
47 %r2 = call i64 @may_not_be_inlined()
48 %r3 = call i64 @may_not_be_inlined()
50 %r5 = add i64 %r3, %r4
53 attributes #0 = { alwaysinline }
54 ; NOBOUNDS: observation: 0
55 ; NOBOUNDS: delta_size: 6
56 ; RELAXED-BOUNDS: delta_size: 6
57 ; BOUNDS: delta_size: 2147483647
58 ; NOBOUNDS: observation: 1
59 ; BOUNDS-NOT: observation
60 ; RELAXED-BOUNDS-NOT: observation
61 ; NOBOUNDS: delta_size: -11
62 ; NOBOUNDS: observation: 2
63 ; NOBOUNDS: delta_size: 4
66 ; must_be_inlined must always be inlined, so we won't find a call to it in @top()
67 ; CHECK-NOT: call i64 @must_be_inlined
68 ; @some-function isn't mandatory, and when we set the increase threshold too low,
69 ; it won't be inlined.
70 ; NOBOUNDS-OUT-NOT: @may_not_be_inlined
71 ; RELAXED-BOUNDS-OUT: call i64 @may_not_be_inlined
72 ; BOUNDS-OUT: call i64 @may_not_be_inlined