82 lines · plain
1; Check that the hotness attribute is included in the optimization record file2; with -lto-pass-remarks-with-hotness.3 4; RUN: llvm-as < %s >%t.bc5; RUN: rm -f %t.yaml %t.t300.yaml %t.t301.yaml6; 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.bc9; RUN: cat %t.yaml | FileCheck -check-prefixes=YAML,YAML-NO-ANNOTATE %s10 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.bc15; RUN: FileCheck -check-prefixes=YAML,YAML-NO-ANNOTATE %s < %t.t300.yaml16 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.bc21; RUN: not FileCheck -check-prefixes=YAML,YAML-NO-ANNOTATE %s < %t.t301.yaml22 23; Check that remarks are annotated with LTO phase information with `-annotate-inline-lto-phase`.24; RUN: llvm-as < %s >%t.bc25; RUN: rm -f %t.yaml %t.t300.yaml %t.t301.yaml26; 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.bc30; RUN: cat %t.yaml | FileCheck -check-prefixes=YAML,YAML-ANNOTATE %s31 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.bc37; RUN: FileCheck -check-prefixes=YAML,YAML-ANNOTATE %s < %t.t300.yaml38 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.bc44; RUN: not FileCheck -check-prefixes=YAML,YAML-ANNOTATE %s < %t.t301.yaml45 46; YAML: --- !Passed47; YAML-NO-ANNOTATE-NEXT: Pass: inline48; YAML-ANNOTATE-NEXT: Pass: postlink-cgscc-inline49; YAML-NEXT: Name: Inlined50; YAML-NEXT: Function: main51; YAML-NEXT: Hotness: 30052; YAML-NEXT: Args:53; YAML-NEXT: - String: ''''54; YAML-NEXT: - Callee: foo55; YAML-NEXT: - String: ''' inlined into '''56; YAML-NEXT: - Caller: main57; 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 %a74}75 76define i32 @main() !prof !0 {77 %i = call i32 @foo()78 ret i32 %i79}80 81!0 = !{!"function_entry_count", i64 300}82