110 lines · plain
1; Test plugin options for opt-remarks.2; RUN: llvm-as %s -o %t.o3; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext -shared \4; RUN: -plugin-opt=save-temps \5; RUN: -plugin-opt=opt-remarks-passes=inline \6; RUN: -plugin-opt=opt-remarks-format=yaml \7; RUN: -plugin-opt=opt-remarks-filename=%t.yaml %t.o -o %t2.o 2>&18; RUN: llvm-dis %t2.o.0.4.opt.bc -o - | FileCheck %s9; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext -shared \10; RUN: -plugin-opt=opt-remarks-passes=inline \11; RUN: -plugin-opt=opt-remarks-format=yaml \12; RUN: -plugin-opt=opt-remarks-with-hotness \13; RUN: -plugin-opt=opt-remarks-filename=%t.hot.yaml %t.o -o %t2.o 2>&114; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext -shared \15; RUN: -plugin-opt=opt-remarks-passes=inline \16; RUN: -plugin-opt=opt-remarks-format=yaml \17; RUN: -plugin-opt=opt-remarks-with-hotness \18; RUN: -plugin-opt=opt-remarks-hotness-threshold=300 \19; RUN: -plugin-opt=opt-remarks-filename=%t.t300.yaml %t.o -o %t2.o 2>&120; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext -shared \21; RUN: -plugin-opt=opt-remarks-passes=inline \22; RUN: -plugin-opt=opt-remarks-format=yaml \23; RUN: -plugin-opt=opt-remarks-with-hotness \24; RUN: -plugin-opt=opt-remarks-hotness-threshold=301 \25; RUN: -plugin-opt=opt-remarks-filename=%t.t301.yaml %t.o -o %t2.o 2>&126; RUN: cat %t.yaml | FileCheck %s -check-prefix=YAML27; RUN: cat %t.hot.yaml | FileCheck %s -check-prefix=YAML-HOT28; RUN: FileCheck %s -check-prefix=YAML-HOT < %t.t300.yaml29; RUN: count 0 < %t.t301.yaml30 31; Check that @f is inlined after optimizations.32; CHECK-LABEL: define i32 @_start33; CHECK-NEXT: %a.i = tail call i32 @bar()34; CHECK-NEXT: ret i32 %a.i35; CHECK-NEXT: }36 37; YAML: --- !Missed38; YAML-NEXT: Pass: inline39; YAML-NEXT: Name: NoDefinition40; YAML-NEXT: Function: f41; YAML-NEXT: Args:42; YAML-NEXT: - Callee: bar43; YAML-NEXT: - String: ' will not be inlined into '44; YAML-NEXT: - Caller: f45; YAML-NEXT: - String: ' because its definition is unavailable'46; YAML-NEXT: ...47; YAML-NEXT: --- !Missed48; YAML-NEXT: Pass: inline49; YAML-NEXT: Name: NoDefinition50; YAML-NEXT: Function: f51; YAML-NEXT: Args:52; YAML-NEXT: - Callee: bar53; YAML-NEXT: - String: ' will not be inlined into '54; YAML-NEXT: - Caller: f55; YAML-NEXT: - String: ' because its definition is unavailable'56; YAML-NEXT: ...57; YAML-NEXT: --- !Passed58; YAML-NEXT: Pass: inline59; YAML-NEXT: Name: Inlined60; YAML-NEXT: Function: _start61; YAML-NEXT: Args:62; YAML-NEXT: - String: ''''63; YAML-NEXT: - Callee: f64; YAML-NEXT: - String: ''' inlined into '''65; YAML-NEXT: - Caller: _start66; YAML-NEXT: - String: ''''67; YAML-NEXT: - String: ' with '68; YAML-NEXT: - String: '(cost='69; YAML-NEXT: - Cost: '0'70; YAML-NEXT: - String: ', threshold='71; YAML-NEXT: - Threshold: '337'72; YAML-NEXT: - String: ')'73; YAML-NEXT: ...74 75; YAML-HOT: --- !Passed76; YAML-HOT: Pass: inline77; YAML-HOT-NEXT: Name: Inlined78; YAML-HOT-NEXT: Function: _start79; YAML-HOT-NEXT: Hotness: 30080; YAML-HOT-NEXT: Args:81; YAML-HOT-NEXT: - String: ''''82; YAML-HOT-NEXT: - Callee: f83; YAML-HOT-NEXT: - String: ''' inlined into '''84; YAML-HOT-NEXT: - Caller: _start85; YAML-HOT-NEXT: - String: ''''86; YAML-HOT-NEXT: - String: ' with '87; YAML-HOT-NEXT: - String: '(cost='88; YAML-HOT-NEXT: - Cost: '0'89; YAML-HOT-NEXT: - String: ', threshold='90; YAML-HOT-NEXT: - Threshold: '337'91; YAML-HOT-NEXT: - String: ')'92; YAML-HOT-NEXT: ...93 94target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"95target triple = "x86_64-unknown-linux-gnu"96 97declare i32 @bar()98 99define i32 @f() {100 %a = call i32 @bar()101 ret i32 %a102}103 104define i32 @_start() !prof !0 {105 %call = call i32 @f()106 ret i32 %call107}108 109!0 = !{!"function_entry_count", i64 300}110