• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llvm-as < %s >%t.bc
2
3; Check pass remarks emitted to YAML file
4; RUN: rm -f %t.yaml
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
11
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
21
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
31
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
38
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
46
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
54
55; YAML: --- !Passed
56; YAML-NEXT: Pass:            inline
57; YAML-NEXT: Name:            Inlined
58; YAML-NEXT: Function:        main
59; YAML-NEXT: Hotness:         300
60; YAML-NEXT: Args:
61; YAML-NEXT:   - Callee:          tinkywinky
62; YAML-NEXT:   - String:          ' inlined into '
63; YAML-NEXT:   - Caller:          main
64; YAML-NEXT:   - String:          ' with '
65; YAML-NEXT:   - String:          '(cost='
66; YAML-NEXT:   - Cost:            '-15000'
67; YAML-NEXT:   - String:          ', threshold='
68; YAML-NEXT:   - Threshold:       '337'
69; YAML-NEXT:   - String:          ')'
70; YAML-NEXT: ...
71
72; CHECK: tinkywinky inlined into main with (cost=-15000, threshold=337) (hotness: 300)
73
74target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
75target triple = "x86_64-scei-ps4"
76
77declare i32 @patatino()
78
79define i32 @tinkywinky() {
80  %a = call i32 @patatino()
81  ret i32 %a
82}
83
84define i32 @main() !prof !0 {
85  %i = call i32 @tinkywinky()
86  ret i32 %i
87}
88
89!0 = !{!"function_entry_count", i64 300}
90