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