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-prefixes=YAML,YAML-NO-ANNOTATE %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-prefixes=YAML,YAML-NO-ANNOTATE %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-prefixes=YAML,YAML-NO-ANNOTATE %s < %t.t301.yaml 22 23; Check that remarks are annotated with LTO phase information with `-annotate-inline-lto-phase`. 24; RUN: llvm-as < %s >%t.bc 25; RUN: rm -f %t.yaml %t.t300.yaml %t.t301.yaml 26; RUN: llvm-lto -lto-pass-remarks-output=%t.yaml \ 27; RUN: -lto-pass-remarks-with-hotness \ 28; RUN: -annotate-inline-phase \ 29; RUN: -exported-symbol _main -o %t.o %t.bc 30; RUN: cat %t.yaml | FileCheck -check-prefixes=YAML,YAML-ANNOTATE %s 31 32; RUN: llvm-lto -lto-pass-remarks-output=%t.t300.yaml \ 33; RUN: -lto-pass-remarks-with-hotness \ 34; RUN: -lto-pass-remarks-hotness-threshold=300 \ 35; RUN: -annotate-inline-phase \ 36; RUN: -exported-symbol _main -o %t.o %t.bc 37; RUN: FileCheck -check-prefixes=YAML,YAML-ANNOTATE %s < %t.t300.yaml 38 39; RUN: llvm-lto -lto-pass-remarks-output=%t.t301.yaml \ 40; RUN: -lto-pass-remarks-with-hotness \ 41; RUN: -lto-pass-remarks-hotness-threshold=301 \ 42; RUN: -annotate-inline-phase \ 43; RUN: -exported-symbol _main -o %t.o %t.bc 44; RUN: not FileCheck -check-prefixes=YAML,YAML-ANNOTATE %s < %t.t301.yaml 45 46; YAML: --- !Passed 47; YAML-NO-ANNOTATE-NEXT: Pass: inline 48; YAML-ANNOTATE-NEXT: Pass: postlink-cgscc-inline 49; YAML-NEXT: Name: Inlined 50; YAML-NEXT: Function: main 51; YAML-NEXT: Hotness: 300 52; YAML-NEXT: Args: 53; YAML-NEXT: - String: '''' 54; YAML-NEXT: - Callee: foo 55; YAML-NEXT: - String: ''' inlined into ''' 56; YAML-NEXT: - Caller: main 57; YAML-NEXT: - String: '''' 58; YAML-NEXT: - String: ' with ' 59; YAML-NEXT: - String: '(cost=' 60; YAML-NEXT: - Cost: '-15000' 61; YAML-NEXT: - String: ', threshold=' 62; YAML-NEXT: - Threshold: '337' 63; YAML-NEXT: - String: ')' 64; YAML-NEXT: ... 65 66target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 67target triple = "x86_64-apple-darwin" 68 69declare i32 @bar() 70 71define i32 @foo() { 72 %a = call i32 @bar() 73 ret i32 %a 74} 75 76define i32 @main() !prof !0 { 77 %i = call i32 @foo() 78 ret i32 %i 79} 80 81!0 = !{!"function_entry_count", i64 300} 82