120 lines · plain
1; RUN: opt < %s -S -passes=inline -pass-remarks-missed=inline \2; RUN: -pass-remarks-with-hotness -pass-remarks-hotness-threshold 15 \3; RUN: -pass-remarks-output=%t 2>&1 | FileCheck %s4; RUN: cat %t | FileCheck -check-prefix=YAML %s5; RUN: opt < %s -S -passes=inline -pass-remarks-with-hotness -pass-remarks-output=%t6; RUN: cat %t | FileCheck -check-prefix=YAML %s7;8; Verify that remarks that don't meet the hotness threshold are not output.9; RUN: opt < %s -S -passes=inline -pass-remarks-missed=inline \10; RUN: -pass-remarks-with-hotness -pass-remarks-hotness-threshold 100 \11; RUN: -pass-remarks-output=%t.threshold 2>&1 | \12; RUN: FileCheck -check-prefix=THRESHOLD %s13; RUN: test ! -s %t.threshold14; RUN: opt < %s -S -passes=inline \15; RUN: -pass-remarks-with-hotness -pass-remarks-hotness-threshold 100 \16; RUN: -pass-remarks-output=%t.threshold17; The remarks output file should be empty.18; RUN: test ! -s %t.threshold19 20; Inliner - Module Wrapper21; RUN: opt < %s -S -passes=inliner-wrapper -pass-remarks-missed=inline \22; RUN: -pass-remarks-with-hotness -pass-remarks-hotness-threshold 15 \23; RUN: -pass-remarks-output=%t 2>&1 | FileCheck %s24; RUN: cat %t | FileCheck -check-prefix=YAML %s25; RUN: opt < %s -S -passes=inliner-wrapper -pass-remarks-with-hotness -pass-remarks-output=%t26; RUN: cat %t | FileCheck -check-prefix=YAML %s27;28; Verify that remarks that don't meet the hotness threshold are not output.29; RUN: opt < %s -S -passes=inliner-wrapper -pass-remarks-missed=inline \30; RUN: -pass-remarks-with-hotness -pass-remarks-hotness-threshold 100 \31; RUN: -pass-remarks-output=%t.threshold 2>&1 | \32; RUN: FileCheck -check-prefix=THRESHOLD %s33; RUN: test ! -s %t.threshold34; RUN: opt < %s -S -passes=inliner-wrapper \35; RUN: -pass-remarks-with-hotness -pass-remarks-hotness-threshold 100 \36; RUN: -pass-remarks-output=%t.threshold37 38; The remarks output file should be empty.39; RUN: test ! -s %t.threshold40 41; Check the YAML file generated for inliner remarks for this program:42;43; 1 int foo();44; 2 int bar();45; 346; 4 int baz() {47; 5 return foo() + bar();48; 6 }49 50; CHECK: remark: /tmp/s.c:5:10: foo will not be inlined into baz because its definition is unavailable (hotness: 30)51; CHECK-NEXT: remark: /tmp/s.c:5:18: bar will not be inlined into baz because its definition is unavailable (hotness: 30)52 53; YAML: --- !Missed54; YAML-NEXT: Pass: inline55; YAML-NEXT: Name: NoDefinition56; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 5, Column: 10 }57; YAML-NEXT: Function: baz58; YAML-NEXT: Hotness: 3059; YAML-NEXT: Args:60; YAML-NEXT: - Callee: foo61; YAML-NEXT: - String: ' will not be inlined into '62; YAML-NEXT: - Caller: baz63; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 4, Column: 0 }64; YAML-NEXT: - String: ' because its definition is unavailable'65; YAML-NEXT: ...66; YAML-NEXT: --- !Missed67; YAML-NEXT: Pass: inline68; YAML-NEXT: Name: NoDefinition69; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 5, Column: 18 }70; YAML-NEXT: Function: baz71; YAML-NEXT: Hotness: 3072; YAML-NEXT: Args:73; YAML-NEXT: - Callee: bar74; YAML-NEXT: - String: ' will not be inlined into '75; YAML-NEXT: - Caller: baz76; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 4, Column: 0 }77; YAML-NEXT: - String: ' because its definition is unavailable'78; YAML-NEXT: ...79 80; No remarks should be output, since none meet the threshold.81; THRESHOLD-NOT: remark82 83; ModuleID = '/tmp/s.c'84source_filename = "/tmp/s.c"85target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"86target triple = "x86_64-apple-macosx10.11.0"87 88; Function Attrs: nounwind ssp uwtable89define i32 @"\01baz"() !dbg !7 !prof !14 {90entry:91 %call = call i32 (...) @foo(), !dbg !992 %call1 = call i32 (...) @"\01bar"(), !dbg !1093 %add = add nsw i32 %call, %call1, !dbg !1294 ret i32 %add, !dbg !1395}96 97declare i32 @foo(...)98 99declare i32 @"\01bar"(...)100 101!llvm.dbg.cu = !{!0}102!llvm.module.flags = !{!3, !4, !5}103!llvm.ident = !{!6}104 105!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 (trunk 281293) (llvm/trunk 281290)", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)106!1 = !DIFile(filename: "/tmp/s.c", directory: "/tmp")107!2 = !{}108!3 = !{i32 2, !"Dwarf Version", i32 4}109!4 = !{i32 2, !"Debug Info Version", i32 3}110!5 = !{i32 1, !"PIC Level", i32 2}111!6 = !{!"clang version 4.0.0 (trunk 281293) (llvm/trunk 281290)"}112!7 = distinct !DISubprogram(name: "baz", scope: !1, file: !1, line: 4, type: !8, isLocal: false, isDefinition: true, scopeLine: 4, isOptimized: true, unit: !0, retainedNodes: !2)113!8 = !DISubroutineType(types: !2)114!9 = !DILocation(line: 5, column: 10, scope: !7)115!10 = !DILocation(line: 5, column: 18, scope: !11)116!11 = !DILexicalBlockFile(scope: !7, file: !1, discriminator: 1)117!12 = !DILocation(line: 5, column: 16, scope: !7)118!13 = !DILocation(line: 5, column: 3, scope: !7)119!14 = !{!"function_entry_count", i64 30}120