1; Test that we can produce a log if we have or do not have a model, in development mode.
2; REQUIRES: have_tf_api
3; RUN: opt -enable-ml-inliner=development -passes=scc-oz-module-inliner -training-log=- -ml-inliner-model-under-training=%S/../../../../lib/Analysis/models/inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -S < %s | FileCheck %s
4; RUN: opt -enable-ml-inliner=development -passes=scc-oz-module-inliner -training-log=- -ml-inliner-model-under-training=%S/../../../../lib/Analysis/models/inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-output-spec-override=%S/Inputs/test_output_spec.json -S < %s | FileCheck %s --check-prefixes=EXTRA-OUTPUTS,CHECK
5; RUN: opt -enable-ml-inliner=development -passes=scc-oz-module-inliner -training-log=- -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -S < %s | FileCheck %s
6; RUN: opt -enable-ml-inliner=development -passes=scc-oz-module-inliner -training-log=- -ml-inliner-model-under-training=%S/../../../../lib/Analysis/models/inliner -S < %s | FileCheck %s --check-prefix=NOREWARD
7; RUN: opt -enable-ml-inliner=development -passes=scc-oz-module-inliner -training-log=- -S < %s | FileCheck %s --check-prefix=NOREWARD
8
9target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
10target triple = "x86_64-pc-linux-gnu"
11
12declare i32 @f1(i32)
13declare i32 @f2(i32)
14
15define dso_local i32 @branches(i32) {
16  %cond = icmp slt i32 %0, 3
17  br i1 %cond, label %then, label %else
18
19then:
20  %ret.1 = call i32 @f1(i32 %0)
21  br label %last.block
22
23else:
24  %ret.2 = call i32 @f2(i32 %0)
25  br label %last.block
26
27last.block:
28  %ret = phi i32 [%ret.1, %then], [%ret.2, %else]
29  ret i32 %ret
30}
31
32define dso_local i32 @top() {
33  %1 = call i32 @branches(i32 2)
34  ret i32 %1
35}
36
37
38!llvm.module.flags = !{!0}
39!llvm.ident = !{!1}
40
41!0 = !{i32 1, !"wchar_size", i32 4}
42!1 = !{!"clang version 7.0.0-6 (tags/RELEASE_700/final)"}
43
44; Check we produce a protobuf that has inlining decisions and rewards.
45; CHECK-NOT: fake_extra_output
46; EXTRA-OUTPUTS:          key: "fake_extra_output" value: {
47; EXTRA-OUTPUTS-NEXT:       feature: { int64_list: { value: [1] } }
48; CHECK:          key: "inlining_decision" value: {
49; CHECK-NEXT:       feature: { int64_list: { value: [1] } }
50; CHECK:          key: "delta_size" value: {
51; CHECK-NEXT:       feature: { int64_list: { value: [0] } }
52; CHECK-NEXT:     }
53; CHECK-NEXT:   }
54; NOREWARD-NOT: key: "delta_size" value: {
55