1; RUN: opt < %s -S -inline -pass-remarks-output=%t -pass-remarks=inline \ 2; RUN: -pass-remarks-missed=inline -pass-remarks-analysis=inline \ 3; RUN: -pass-remarks-with-hotness 2>&1 | FileCheck %s 4; RUN: cat %t | FileCheck -check-prefix=YAML %s 5 6; RUN: opt < %s -S -passes=inline -pass-remarks-output=%t -pass-remarks=inline \ 7; RUN: -pass-remarks-missed=inline -pass-remarks-analysis=inline \ 8; RUN: -pass-remarks-with-hotness 2>&1 | FileCheck %s 9; RUN: cat %t | FileCheck -check-prefix=YAML %s 10 11; Check the YAML file for inliner-generated passed and analysis remarks. This 12; is the input: 13 14; 1 int foo() { return 1; } 15; 2 16; 3 int bar() { 17; 4 return foo(); 18; 5 } 19 20; CHECK: remark: /tmp/s.c:4:10: foo inlined into bar with cost={{[0-9\-]+}} (threshold={{[0-9]+}}) (hotness: 30) 21 22; YAML: --- !Passed 23; YAML-NEXT: Pass: inline 24; YAML-NEXT: Name: Inlined 25; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 4, Column: 10 } 26; YAML-NEXT: Function: bar 27; YAML-NEXT: Hotness: 30 28; YAML-NEXT: Args: 29; YAML-NEXT: - Callee: foo 30; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 1, Column: 0 } 31; YAML-NEXT: - String: ' inlined into ' 32; YAML-NEXT: - Caller: bar 33; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 3, Column: 0 } 34; YAML-NEXT: - String: ' with cost=' 35; YAML-NEXT: - Cost: '{{[0-9\-]+}}' 36; YAML-NEXT: - String: ' (threshold=' 37; YAML-NEXT: - Threshold: '{{[0-9]+}}' 38; YAML-NEXT: - String: ')' 39; YAML-NEXT: ... 40 41; ModuleID = '/tmp/s.c' 42source_filename = "/tmp/s.c" 43target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 44target triple = "x86_64-apple-macosx10.11.0" 45 46; Function Attrs: nounwind ssp uwtable 47define i32 @foo() #0 !dbg !7 { 48entry: 49 ret i32 1, !dbg !9 50} 51 52; Function Attrs: nounwind ssp uwtable 53define i32 @bar() #0 !dbg !10 !prof !13 { 54entry: 55 %call = call i32 @foo(), !dbg !11 56 ret i32 %call, !dbg !12 57} 58 59attributes #0 = { nounwind ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+fxsr,+mmx,+sse,+sse2,+sse3,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 60 61!llvm.dbg.cu = !{!0} 62!llvm.module.flags = !{!3, !4, !5} 63!llvm.ident = !{!6} 64 65!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 (trunk 282540) (llvm/trunk 282542)", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2) 66!1 = !DIFile(filename: "/tmp/s.c", directory: "/tmp") 67!2 = !{} 68!3 = !{i32 2, !"Dwarf Version", i32 4} 69!4 = !{i32 2, !"Debug Info Version", i32 3} 70!5 = !{i32 1, !"PIC Level", i32 2} 71!6 = !{!"clang version 4.0.0 (trunk 282540) (llvm/trunk 282542)"} 72!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !2) 73!8 = !DISubroutineType(types: !2) 74!9 = !DILocation(line: 1, column: 13, scope: !7) 75!10 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0, retainedNodes: !2) 76!11 = !DILocation(line: 4, column: 10, scope: !10) 77!12 = !DILocation(line: 4, column: 3, scope: !10) 78!13 = !{!"function_entry_count", i64 30} 79