Brian Gesiak | 4ef3daa | 2017-06-30 23:14:53 +0000 | [diff] [blame^] | 1 | ; RUN: opt < %s -S -inline -pass-remarks-missed=inline \ |
| 2 | ; RUN: -pass-remarks-with-hotness -pass-remarks-hotness-threshold 15 \ |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 3 | ; RUN: -pass-remarks-output=%t 2>&1 | FileCheck %s |
| 4 | ; RUN: cat %t | FileCheck -check-prefix=YAML %s |
Hal Finkel | bdd6735 | 2016-10-04 18:13:45 +0000 | [diff] [blame] | 5 | ; RUN: opt < %s -S -inline -pass-remarks-with-hotness -pass-remarks-output=%t |
| 6 | ; RUN: cat %t | FileCheck -check-prefix=YAML %s |
Brian Gesiak | 4ef3daa | 2017-06-30 23:14:53 +0000 | [diff] [blame^] | 7 | ; |
| 8 | ; Verify that remarks that don't meet the hotness threshold are not output. |
| 9 | ; RUN: opt < %s -S -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 %s |
| 13 | ; RUN: test ! -s %t.threshold |
| 14 | ; RUN: opt < %s -S -inline \ |
| 15 | ; RUN: -pass-remarks-with-hotness -pass-remarks-hotness-threshold 100 \ |
| 16 | ; RUN: -pass-remarks-output=%t.threshold |
| 17 | ; The remarks output file should be empty. |
| 18 | ; RUN: test ! -s %t.threshold |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 19 | |
| 20 | ; Check the YAML file generated for inliner remarks for this program: |
| 21 | ; |
| 22 | ; 1 int foo(); |
| 23 | ; 2 int bar(); |
| 24 | ; 3 |
| 25 | ; 4 int baz() { |
| 26 | ; 5 return foo() + bar(); |
| 27 | ; 6 } |
| 28 | |
Adam Nemet | 1142147 | 2016-09-27 21:58:17 +0000 | [diff] [blame] | 29 | ; CHECK: remark: /tmp/s.c:5:10: foo will not be inlined into baz because its definition is unavailable (hotness: 30) |
| 30 | ; CHECK-NEXT: remark: /tmp/s.c:5:18: bar will not be inlined into baz because its definition is unavailable (hotness: 30) |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 31 | |
| 32 | ; YAML: --- !Missed |
| 33 | ; YAML-NEXT: Pass: inline |
Adam Nemet | 1142147 | 2016-09-27 21:58:17 +0000 | [diff] [blame] | 34 | ; YAML-NEXT: Name: NoDefinition |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 35 | ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 5, Column: 10 } |
| 36 | ; YAML-NEXT: Function: baz |
| 37 | ; YAML-NEXT: Hotness: 30 |
| 38 | ; YAML-NEXT: Args: |
| 39 | ; YAML-NEXT: - Callee: foo |
Adam Nemet | 0428e93 | 2016-10-04 17:05:04 +0000 | [diff] [blame] | 40 | ; YAML-NEXT: - String: ' will not be inlined into ' |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 41 | ; YAML-NEXT: - Caller: baz |
Adam Nemet | b103fc5 | 2016-11-07 22:41:13 +0000 | [diff] [blame] | 42 | ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 4, Column: 0 } |
Adam Nemet | 0428e93 | 2016-10-04 17:05:04 +0000 | [diff] [blame] | 43 | ; YAML-NEXT: - String: ' because its definition is unavailable' |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 44 | ; YAML-NEXT: ... |
| 45 | ; YAML-NEXT: --- !Missed |
| 46 | ; YAML-NEXT: Pass: inline |
Adam Nemet | 1142147 | 2016-09-27 21:58:17 +0000 | [diff] [blame] | 47 | ; YAML-NEXT: Name: NoDefinition |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 48 | ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 5, Column: 18 } |
| 49 | ; YAML-NEXT: Function: baz |
| 50 | ; YAML-NEXT: Hotness: 30 |
| 51 | ; YAML-NEXT: Args: |
| 52 | ; YAML-NEXT: - Callee: bar |
Adam Nemet | 0428e93 | 2016-10-04 17:05:04 +0000 | [diff] [blame] | 53 | ; YAML-NEXT: - String: ' will not be inlined into ' |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 54 | ; YAML-NEXT: - Caller: baz |
Adam Nemet | b103fc5 | 2016-11-07 22:41:13 +0000 | [diff] [blame] | 55 | ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 4, Column: 0 } |
Adam Nemet | 0428e93 | 2016-10-04 17:05:04 +0000 | [diff] [blame] | 56 | ; YAML-NEXT: - String: ' because its definition is unavailable' |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 57 | ; YAML-NEXT: ... |
| 58 | |
Brian Gesiak | 4ef3daa | 2017-06-30 23:14:53 +0000 | [diff] [blame^] | 59 | ; No remarks should be output, since none meet the threshold. |
| 60 | ; THRESHOLD-NOT: remark |
| 61 | |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 62 | ; ModuleID = '/tmp/s.c' |
| 63 | source_filename = "/tmp/s.c" |
| 64 | target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
| 65 | target triple = "x86_64-apple-macosx10.11.0" |
| 66 | |
| 67 | ; Function Attrs: nounwind ssp uwtable |
Adam Nemet | 7da20c3 | 2016-11-10 17:47:03 +0000 | [diff] [blame] | 68 | define i32 @"\01baz"() !dbg !7 !prof !14 { |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 69 | entry: |
| 70 | %call = call i32 (...) @foo(), !dbg !9 |
Adam Nemet | ee5cf03 | 2016-10-08 04:47:20 +0000 | [diff] [blame] | 71 | %call1 = call i32 (...) @"\01bar"(), !dbg !10 |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 72 | %add = add nsw i32 %call, %call1, !dbg !12 |
| 73 | ret i32 %add, !dbg !13 |
| 74 | } |
| 75 | |
| 76 | declare i32 @foo(...) |
| 77 | |
Adam Nemet | ee5cf03 | 2016-10-08 04:47:20 +0000 | [diff] [blame] | 78 | declare i32 @"\01bar"(...) |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 79 | |
| 80 | !llvm.dbg.cu = !{!0} |
| 81 | !llvm.module.flags = !{!3, !4, !5} |
| 82 | !llvm.ident = !{!6} |
| 83 | |
| 84 | !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) |
| 85 | !1 = !DIFile(filename: "/tmp/s.c", directory: "/tmp") |
| 86 | !2 = !{} |
| 87 | !3 = !{i32 2, !"Dwarf Version", i32 4} |
| 88 | !4 = !{i32 2, !"Debug Info Version", i32 3} |
| 89 | !5 = !{i32 1, !"PIC Level", i32 2} |
| 90 | !6 = !{!"clang version 4.0.0 (trunk 281293) (llvm/trunk 281290)"} |
| 91 | !7 = distinct !DISubprogram(name: "baz", scope: !1, file: !1, line: 4, type: !8, isLocal: false, isDefinition: true, scopeLine: 4, isOptimized: true, unit: !0, variables: !2) |
| 92 | !8 = !DISubroutineType(types: !2) |
| 93 | !9 = !DILocation(line: 5, column: 10, scope: !7) |
| 94 | !10 = !DILocation(line: 5, column: 18, scope: !11) |
| 95 | !11 = !DILexicalBlockFile(scope: !7, file: !1, discriminator: 1) |
| 96 | !12 = !DILocation(line: 5, column: 16, scope: !7) |
| 97 | !13 = !DILocation(line: 5, column: 3, scope: !7) |
| 98 | !14 = !{!"function_entry_count", i64 30} |