Adam Nemet | 0427909 | 2016-09-27 23:46:59 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -S -inline -pass-remarks-missed=inline -pass-remarks-with-hotness \ |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 2 | ; RUN: -pass-remarks-output=%t 2>&1 | FileCheck %s |
| 3 | ; RUN: cat %t | FileCheck -check-prefix=YAML %s |
| 4 | |
| 5 | ; Check the YAML file generated for inliner remarks for this program: |
| 6 | ; |
| 7 | ; 1 int foo(); |
| 8 | ; 2 int bar(); |
| 9 | ; 3 |
| 10 | ; 4 int baz() { |
| 11 | ; 5 return foo() + bar(); |
| 12 | ; 6 } |
| 13 | |
Adam Nemet | 1142147 | 2016-09-27 21:58:17 +0000 | [diff] [blame] | 14 | ; CHECK: remark: /tmp/s.c:5:10: foo will not be inlined into baz because its definition is unavailable (hotness: 30) |
| 15 | ; 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] | 16 | |
| 17 | ; YAML: --- !Missed |
| 18 | ; YAML-NEXT: Pass: inline |
Adam Nemet | 1142147 | 2016-09-27 21:58:17 +0000 | [diff] [blame] | 19 | ; YAML-NEXT: Name: NoDefinition |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 20 | ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 5, Column: 10 } |
| 21 | ; YAML-NEXT: Function: baz |
| 22 | ; YAML-NEXT: Hotness: 30 |
| 23 | ; YAML-NEXT: Args: |
| 24 | ; YAML-NEXT: - Callee: foo |
Adam Nemet | 0428e93 | 2016-10-04 17:05:04 +0000 | [diff] [blame^] | 25 | ; YAML-NEXT: - String: ' will not be inlined into ' |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 26 | ; YAML-NEXT: - Caller: baz |
Adam Nemet | 0428e93 | 2016-10-04 17:05:04 +0000 | [diff] [blame^] | 27 | ; YAML-NEXT: - String: ' because its definition is unavailable' |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 28 | ; YAML-NEXT: ... |
| 29 | ; YAML-NEXT: --- !Missed |
| 30 | ; YAML-NEXT: Pass: inline |
Adam Nemet | 1142147 | 2016-09-27 21:58:17 +0000 | [diff] [blame] | 31 | ; YAML-NEXT: Name: NoDefinition |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 32 | ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 5, Column: 18 } |
| 33 | ; YAML-NEXT: Function: baz |
| 34 | ; YAML-NEXT: Hotness: 30 |
| 35 | ; YAML-NEXT: Args: |
| 36 | ; YAML-NEXT: - Callee: bar |
Adam Nemet | 0428e93 | 2016-10-04 17:05:04 +0000 | [diff] [blame^] | 37 | ; YAML-NEXT: - String: ' will not be inlined into ' |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 38 | ; YAML-NEXT: - Caller: baz |
Adam Nemet | 0428e93 | 2016-10-04 17:05:04 +0000 | [diff] [blame^] | 39 | ; YAML-NEXT: - String: ' because its definition is unavailable' |
Adam Nemet | a62b7e1 | 2016-09-27 20:55:07 +0000 | [diff] [blame] | 40 | ; YAML-NEXT: ... |
| 41 | |
| 42 | ; ModuleID = '/tmp/s.c' |
| 43 | source_filename = "/tmp/s.c" |
| 44 | target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
| 45 | target triple = "x86_64-apple-macosx10.11.0" |
| 46 | |
| 47 | ; Function Attrs: nounwind ssp uwtable |
| 48 | define i32 @baz() !dbg !7 !prof !14 { |
| 49 | entry: |
| 50 | %call = call i32 (...) @foo(), !dbg !9 |
| 51 | %call1 = call i32 (...) @bar(), !dbg !10 |
| 52 | %add = add nsw i32 %call, %call1, !dbg !12 |
| 53 | ret i32 %add, !dbg !13 |
| 54 | } |
| 55 | |
| 56 | declare i32 @foo(...) |
| 57 | |
| 58 | declare i32 @bar(...) |
| 59 | |
| 60 | !llvm.dbg.cu = !{!0} |
| 61 | !llvm.module.flags = !{!3, !4, !5} |
| 62 | !llvm.ident = !{!6} |
| 63 | |
| 64 | !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) |
| 65 | !1 = !DIFile(filename: "/tmp/s.c", directory: "/tmp") |
| 66 | !2 = !{} |
| 67 | !3 = !{i32 2, !"Dwarf Version", i32 4} |
| 68 | !4 = !{i32 2, !"Debug Info Version", i32 3} |
| 69 | !5 = !{i32 1, !"PIC Level", i32 2} |
| 70 | !6 = !{!"clang version 4.0.0 (trunk 281293) (llvm/trunk 281290)"} |
| 71 | !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) |
| 72 | !8 = !DISubroutineType(types: !2) |
| 73 | !9 = !DILocation(line: 5, column: 10, scope: !7) |
| 74 | !10 = !DILocation(line: 5, column: 18, scope: !11) |
| 75 | !11 = !DILexicalBlockFile(scope: !7, file: !1, discriminator: 1) |
| 76 | !12 = !DILocation(line: 5, column: 16, scope: !7) |
| 77 | !13 = !DILocation(line: 5, column: 3, scope: !7) |
| 78 | !14 = !{!"function_entry_count", i64 30} |