• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Check that the hotness attribute is included in the optimization record file
2; with -lto-pass-remarks-with-hotness.
3
4; RUN: llvm-as < %s >%t.bc
5; RUN: rm -f %t.yaml %t.t300.yaml %t.t301.yaml
6; RUN: llvm-lto -lto-pass-remarks-output=%t.yaml \
7; RUN:          -lto-pass-remarks-with-hotness \
8; RUN:          -exported-symbol _main -o %t.o %t.bc
9; RUN: cat %t.yaml | FileCheck -check-prefix=YAML %s
10
11; RUN: llvm-lto -lto-pass-remarks-output=%t.t300.yaml \
12; RUN:          -lto-pass-remarks-with-hotness \
13; RUN:          -lto-pass-remarks-hotness-threshold=300 \
14; RUN:          -exported-symbol _main -o %t.o %t.bc
15; RUN: FileCheck -check-prefix=YAML %s < %t.t300.yaml
16
17; RUN: llvm-lto -lto-pass-remarks-output=%t.t301.yaml \
18; RUN:          -lto-pass-remarks-with-hotness \
19; RUN:          -lto-pass-remarks-hotness-threshold=301 \
20; RUN:          -exported-symbol _main -o %t.o %t.bc
21; RUN: not FileCheck -check-prefix=YAML %s < %t.t301.yaml
22
23; YAML:      --- !Passed
24; YAML-NEXT: Pass:            inline
25; YAML-NEXT: Name:            Inlined
26; YAML-NEXT: Function:        main
27; YAML-NEXT: Hotness:         300
28; YAML-NEXT: Args:
29; YAML-NEXT:   - Callee:          foo
30; YAML-NEXT:   - String:          ' inlined into '
31; YAML-NEXT:   - Caller:          main
32; YAML-NEXT:   - String:          ' with '
33; YAML-NEXT:   - String:          '(cost='
34; YAML-NEXT:   - Cost:            '-15000'
35; YAML-NEXT:   - String:          ', threshold='
36; YAML-NEXT:   - Threshold:       '337'
37; YAML-NEXT:   - String:          ')'
38; YAML-NEXT: ...
39
40target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
41target triple = "x86_64-apple-darwin"
42
43declare i32 @bar()
44
45define i32 @foo() {
46  %a = call i32 @bar()
47  ret i32 %a
48}
49
50define i32 @main() !prof !0 {
51  %i = call i32 @foo()
52  ret i32 %i
53}
54
55!0 = !{!"function_entry_count", i64 300}
56