1; RUN: opt -module-summary %s -o %t1.bc
2; RUN: opt -module-summary %p/Inputs/diagnostic-handler-remarks.ll -o %t2.bc
3
4; Check that the hotness attribute is included in the optimization record file
5; with -lto-pass-remarks-with-hotness.
6
7; RUN: llvm-lto -thinlto-action=run \
8; RUN:          -lto-pass-remarks-output=%t.yaml \
9; RUN:          -lto-pass-remarks-with-hotness \
10; RUN:          -exported-symbol _func2 \
11; RUN:          -exported-symbol _main %t1.bc %t2.bc 2>&1 | \
12; RUN:     FileCheck %s -allow-empty
13; CHECK-NOT: remark:
14; CHECK-NOT: llvm-lto:
15
16
17; Verify that bar is imported and inlined into foo
18; RUN: cat %t.yaml.thin.0.yaml | FileCheck %s -check-prefix=YAML1
19; YAML1:      --- !Passed
20; YAML1-NEXT: Pass:            inline
21; YAML1-NEXT: Name:            Inlined
22; YAML1-NEXT: Function:        main
23; YAML1-NEXT: Hotness:         50
24; YAML1-NEXT: Args:
25; YAML1-NEXT:   - Callee:          foo
26; YAML1-NEXT:   - String:          ' inlined into '
27; YAML1-NEXT:   - Caller:          main
28; YAML1-NEXT:   - String:          ' with '
29; YAML1-NEXT:   - String:          '(cost='
30; YAML1-NEXT:   - Cost:            '-30'
31; YAML1-NEXT:   - String:          ', threshold='
32; YAML1-NEXT:   - Threshold:       '337'
33; YAML1-NEXT:   - String:          ')'
34; YAML1-NEXT: ...
35
36
37; Verify that bar is imported and inlined into foo
38; RUN: cat %t.yaml.thin.1.yaml | FileCheck %s -check-prefix=YAML2
39; YAML2:      --- !Passed
40; YAML2-NEXT: Pass:            inline
41; YAML2-NEXT: Name:            Inlined
42; YAML2-NEXT: Function:        foo
43; YAML2-NEXT: Args:
44; YAML2-NEXT:   - Callee:          bar
45; YAML2-NEXT:   - String:          ' inlined into '
46; YAML2-NEXT:   - Caller:          foo
47; YAML2-NEXT:   - String:          ' with '
48; YAML2-NEXT:   - String:          '(cost='
49; YAML2-NEXT:   - Cost:            '-30'
50; YAML2-NEXT:   - String:          ', threshold='
51; YAML2-NEXT:   - Threshold:       '337'
52; YAML2-NEXT:   - String:          ')'
53; YAML2-NEXT: ...
54
55
56target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
57target triple = "x86_64-apple-macosx10.11.0"
58
59define i32 @bar() {
60	ret i32 42
61}
62declare i32 @foo()
63define i32 @main() !prof !0 {
64  %i = call i32 @foo()
65  ret i32 %i
66}
67
68!0 = !{!"function_entry_count", i64 50}
69