1 | ; Test to ensure -fdiagnostics-show-hotness and -fsave-optimization-record |
2 | ; work when invoking the ThinLTO backend path. |
3 | ; REQUIRES: x86-registered-target |
4 | |
5 | ; RUN: opt -module-summary -o %t.o %s |
6 | ; RUN: llvm-lto -thinlto -o %t %t.o |
7 | |
8 | ; First try YAML pass remarks file |
9 | ; RUN: rm -f %t2.opt.yaml |
10 | ; RUN: %clang -target x86_64-scei-ps4 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -fsave-optimization-record -fdiagnostics-show-hotness -o %t2.o -c |
11 | ; RUN: cat %t2.opt.yaml | FileCheck %s -check-prefix=YAML |
12 | |
13 | ; YAML: --- !Passed |
14 | ; YAML-NEXT: Pass: inline |
15 | ; YAML-NEXT: Name: Inlined |
16 | ; YAML-NEXT: Function: main |
17 | ; YAML-NEXT: Hotness: 300 |
18 | ; YAML-NEXT: Args: |
19 | ; YAML-NEXT: - Callee: tinkywinky |
20 | ; YAML-NEXT: - String: ' inlined into ' |
21 | ; YAML-NEXT: - Caller: main |
22 | ; YAML-NEXT: - String: ' with ' |
23 | ; YAML-NEXT: - String: '(cost=' |
24 | ; YAML-NEXT: - Cost: '0' |
25 | ; YAML-NEXT: - String: ', threshold=' |
26 | ; YAML-NEXT: - Threshold: '337' |
27 | ; YAML-NEXT: - String: ')' |
28 | ; YAML-NEXT: ... |
29 | |
30 | ; Next try with pass remarks to stderr |
31 | ; RUN: %clang -target x86_64-scei-ps4 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -mllvm -pass-remarks=inline -fdiagnostics-show-hotness -o %t2.o -c 2>&1 | FileCheck %s |
32 | |
33 | ; CHECK: tinkywinky inlined into main with (cost=0, threshold=337) (hotness: 300) |
34 | |
35 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
36 | target triple = "x86_64-scei-ps4" |
37 | |
38 | declare i32 @patatino() |
39 | |
40 | define i32 @tinkywinky() { |
41 | %a = call i32 @patatino() |
42 | ret i32 %a |
43 | } |
44 | |
45 | define i32 @main() !prof !0 { |
46 | %i = call i32 @tinkywinky() |
47 | ret i32 %i |
48 | } |
49 | |
50 | !0 = !{!"function_entry_count", i64 300} |
51 | |