| 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: - String: '''' |
| 20 |
; YAML-NEXT: - Callee: tinkywinky |
| 21 |
; YAML-NEXT: - String: ''' inlined into ''' |
| 22 |
; YAML-NEXT: - Caller: main |
| 23 |
; YAML-NEXT: - String: '''' |
| 24 |
; YAML-NEXT: - String: ' with ' |
| 25 |
; YAML-NEXT: - String: '(cost=' |
| 26 |
; YAML-NEXT: - Cost: '0' |
| 27 |
; YAML-NEXT: - String: ', threshold=' |
| 28 |
; YAML-NEXT: - Threshold: '337' |
| 29 |
; YAML-NEXT: - String: ')' |
| 30 |
; YAML-NEXT: ... |
| 31 |
|
| 32 |
; Next try with pass remarks to stderr |
| 33 |
; RUN: %clang -target x86_64-scei-ps4 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -Rpass=inline -fdiagnostics-show-hotness -o %t2.o -c 2>&1 | FileCheck %s |
| 34 |
|
| 35 |
; CHECK: 'tinkywinky' inlined into 'main' with (cost=0, threshold=337) (hotness: 300) |
| 36 |
|
| 37 |
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 38 |
target triple = "x86_64-scei-ps4" |
| 39 |
|
| 40 |
declare i32 @patatino() |
| 41 |
|
| 42 |
define i32 @tinkywinky() { |
| 43 |
%a = call i32 @patatino() |
| 44 |
ret i32 %a |
| 45 |
} |
| 46 |
|
| 47 |
define i32 @main() !prof !0 { |
| 48 |
%i = call i32 @tinkywinky() |
| 49 |
ret i32 %i |
| 50 |
} |
| 51 |
|
| 52 |
!0 = !{!"function_entry_count", i64 300} |