OSDN Git Service

Enrich inline messages
[android-x86/external-llvm.git] / test / Transforms / Inline / optimization-remarks-passed-yaml.ll
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 '
35 ; YAML-NEXT:   - String: '(cost='
36 ; YAML-NEXT:   - Cost: '{{[0-9\-]+}}'
37 ; YAML-NEXT:   - String: ', threshold='
38 ; YAML-NEXT:   - Threshold: '{{[0-9]+}}'
39 ; YAML-NEXT:   - String: ')'
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 @foo() #0 !dbg !7 {
49 entry:
50   ret i32 1, !dbg !9
51 }
52
53 ; Function Attrs: nounwind ssp uwtable
54 define i32 @bar() #0 !dbg !10 !prof !13 {
55 entry:
56   %call = call i32 @foo(), !dbg !11
57   ret i32 %call, !dbg !12
58 }
59
60 attributes #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" }
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 282540) (llvm/trunk 282542)", 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 282540) (llvm/trunk 282542)"}
73 !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)
74 !8 = !DISubroutineType(types: !2)
75 !9 = !DILocation(line: 1, column: 13, scope: !7)
76 !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)
77 !11 = !DILocation(line: 4, column: 10, scope: !10)
78 !12 = !DILocation(line: 4, column: 3, scope: !10)
79 !13 = !{!"function_entry_count", i64 30}