1 ; RUN: llvm-as < %s >%t.bc
3 ; Check pass remarks emitted to YAML file
5 ; RUN: llvm-lto2 run -pass-remarks-output=%t.yaml \
6 ; RUN: -pass-remarks-with-hotness \
7 ; RUN: -r %t.bc,tinkywinky,p \
8 ; RUN: -r %t.bc,patatino,px \
9 ; RUN: -r %t.bc,main,px -o %t.o %t.bc
10 ; RUN: cat %t.yaml | FileCheck %s -check-prefix=YAML
12 ; Check low threshold allows remarks to emit.
13 ; RUN: rm -f %t.t300.yaml
14 ; RUN: llvm-lto2 run -pass-remarks-output=%t.t300.yaml \
15 ; RUN: -pass-remarks-with-hotness \
16 ; RUN: -pass-remarks-hotness-threshold=300 \
17 ; RUN: -r %t.bc,tinkywinky,p \
18 ; RUN: -r %t.bc,patatino,px \
19 ; RUN: -r %t.bc,main,px -o %t.o %t.bc
20 ; RUN: FileCheck %s -check-prefix=YAML < %t.t300.yaml
22 ; Check high threshold disallows remarks to emit.
23 ; RUN: rm -f %t.t301.yaml
24 ; RUN: llvm-lto2 run -pass-remarks-output=%t.t301.yaml \
25 ; RUN: -pass-remarks-with-hotness \
26 ; RUN: -pass-remarks-hotness-threshold=301 \
27 ; RUN: -r %t.bc,tinkywinky,p \
28 ; RUN: -r %t.bc,patatino,px \
29 ; RUN: -r %t.bc,main,px -o %t.o %t.bc
30 ; RUN: count 0 < %t.t301.yaml
32 ; Check pass remarks emitted to stderr
33 ; RUN: llvm-lto2 run -pass-remarks=inline \
34 ; RUN: -pass-remarks-with-hotness \
35 ; RUN: -r %t.bc,tinkywinky,p \
36 ; RUN: -r %t.bc,patatino,px \
37 ; RUN: -r %t.bc,main,px -o %t.o %t.bc 2>&1 | FileCheck %s
39 ; Check low threshold allows remarks to emit.
40 ; RUN: llvm-lto2 run -pass-remarks=inline \
41 ; RUN: -pass-remarks-with-hotness \
42 ; RUN: -pass-remarks-hotness-threshold=300 \
43 ; RUN: -r %t.bc,tinkywinky,p \
44 ; RUN: -r %t.bc,patatino,px \
45 ; RUN: -r %t.bc,main,px -o %t.o %t.bc 2>&1 | FileCheck %s
47 ; Check high threshold disallows remarks to emit.
48 ; RUN: llvm-lto2 run -pass-remarks=inline \
49 ; RUN: -pass-remarks-with-hotness \
50 ; RUN: -pass-remarks-hotness-threshold=301 \
51 ; RUN: -r %t.bc,tinkywinky,p \
52 ; RUN: -r %t.bc,patatino,px \
53 ; RUN: -r %t.bc,main,px -o %t.o %t.bc 2>&1 | count 0
56 ; YAML-NEXT: Pass: inline
57 ; YAML-NEXT: Name: Inlined
58 ; YAML-NEXT: Function: main
59 ; YAML-NEXT: Hotness: 300
61 ; YAML-NEXT: - String: ''''
62 ; YAML-NEXT: - Callee: tinkywinky
63 ; YAML-NEXT: - String: ''' inlined into '''
64 ; YAML-NEXT: - Caller: main
65 ; YAML-NEXT: - String: ''''
66 ; YAML-NEXT: - String: ' with '
67 ; YAML-NEXT: - String: '(cost='
68 ; YAML-NEXT: - Cost: '-15000'
69 ; YAML-NEXT: - String: ', threshold='
70 ; YAML-NEXT: - Threshold: '337'
71 ; YAML-NEXT: - String: ')'
74 ; CHECK: 'tinkywinky' inlined into 'main' with (cost=-15000, threshold=337) (hotness: 300)
76 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
77 target triple = "x86_64-scei-ps4"
79 declare i32 @patatino()
81 define i32 @tinkywinky() {
82 %a = call i32 @patatino()
86 define i32 @main() !prof !0 {
87 %i = call i32 @tinkywinky()
91 !0 = !{!"function_entry_count", i64 300}