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-prefixes=YAML,YAML-NO-ANNOTATE 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-prefixes=YAML,YAML-NO-ANNOTATE < %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; Check that remarks are annotated with LTO phase information with `-annotate-inline-phase`. 56; RUN: rm -f %t.yaml 57; RUN: llvm-lto2 run -pass-remarks-output=%t.yaml \ 58; RUN: -pass-remarks-with-hotness \ 59; RUN: -annotate-inline-phase \ 60; RUN: -r %t.bc,tinkywinky,p \ 61; RUN: -r %t.bc,patatino,px \ 62; RUN: -r %t.bc,main,px -o %t.o %t.bc 63; RUN: cat %t.yaml | FileCheck %s -check-prefixes=YAML,YAML-ANNOTATE 64 65; Run again with `-annotate-inline-phase`. 66; RUN: rm -f %t.t300.yaml 67; RUN: llvm-lto2 run -pass-remarks-output=%t.t300.yaml \ 68; RUN: -pass-remarks-with-hotness \ 69; RUN: -pass-remarks-hotness-threshold=300 \ 70; RUN: -annotate-inline-phase \ 71; RUN: -r %t.bc,tinkywinky,p \ 72; RUN: -r %t.bc,patatino,px \ 73; RUN: -r %t.bc,main,px -o %t.o %t.bc 74; RUN: FileCheck %s -check-prefixes=YAML,YAML-ANNOTATE < %t.t300.yaml 75 76; YAML: --- !Passed 77; YAML-NO-ANNOTATE-NEXT: Pass: inline 78; YAML-ANNOTATE-NEXT: Pass: postlink-cgscc-inline 79 80; YAML-NEXT: Name: Inlined 81; YAML-NEXT: Function: main 82; YAML-NEXT: Hotness: 300 83; YAML-NEXT: Args: 84; YAML-NEXT: - String: '''' 85; YAML-NEXT: - Callee: tinkywinky 86; YAML-NEXT: - String: ''' inlined into ''' 87; YAML-NEXT: - Caller: main 88; YAML-NEXT: - String: '''' 89; YAML-NEXT: - String: ' with ' 90; YAML-NEXT: - String: '(cost=' 91; YAML-NEXT: - Cost: '-15000' 92; YAML-NEXT: - String: ', threshold=' 93; YAML-NEXT: - Threshold: '337' 94; YAML-NEXT: - String: ')' 95; YAML-NEXT: ... 96 97; CHECK: 'tinkywinky' inlined into 'main' with (cost=-15000, threshold=337) (hotness: 300) 98 99target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 100target triple = "x86_64-scei-ps4" 101 102declare i32 @patatino() 103 104define i32 @tinkywinky() { 105 %a = call i32 @patatino() 106 ret i32 %a 107} 108 109define i32 @main() !prof !0 { 110 %i = call i32 @tinkywinky() 111 ret i32 %i 112} 113 114!0 = !{!"function_entry_count", i64 300} 115