blob: 45ed78d6592585ae5938c6011c766069232ba3b1 [file] [log] [blame]
Adam Nemeta62b7e12016-09-27 20:55:07 +00001; RUN: opt < %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
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
14; CHECK: remark: /tmp/s.c:5:10: foo will not be inlined into baz (hotness: 30)
15; CHECK-NEXT: remark: /tmp/s.c:5:18: bar will not be inlined into baz (hotness: 30)
16
17; YAML: --- !Missed
18; YAML-NEXT: Pass: inline
19; YAML-NEXT: Name: NotInlined
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
25; YAML-NEXT: - String: will not be inlined into
26; YAML-NEXT: - Caller: baz
27; YAML-NEXT: ...
28; YAML-NEXT: --- !Missed
29; YAML-NEXT: Pass: inline
30; YAML-NEXT: Name: NotInlined
31; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 5, Column: 18 }
32; YAML-NEXT: Function: baz
33; YAML-NEXT: Hotness: 30
34; YAML-NEXT: Args:
35; YAML-NEXT: - Callee: bar
36; YAML-NEXT: - String: will not be inlined into
37; YAML-NEXT: - Caller: baz
38; YAML-NEXT: ...
39
40; ModuleID = '/tmp/s.c'
41source_filename = "/tmp/s.c"
42target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
43target triple = "x86_64-apple-macosx10.11.0"
44
45; Function Attrs: nounwind ssp uwtable
46define i32 @baz() !dbg !7 !prof !14 {
47entry:
48 %call = call i32 (...) @foo(), !dbg !9
49 %call1 = call i32 (...) @bar(), !dbg !10
50 %add = add nsw i32 %call, %call1, !dbg !12
51 ret i32 %add, !dbg !13
52}
53
54declare i32 @foo(...)
55
56declare i32 @bar(...)
57
58!llvm.dbg.cu = !{!0}
59!llvm.module.flags = !{!3, !4, !5}
60!llvm.ident = !{!6}
61
62!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)
63!1 = !DIFile(filename: "/tmp/s.c", directory: "/tmp")
64!2 = !{}
65!3 = !{i32 2, !"Dwarf Version", i32 4}
66!4 = !{i32 2, !"Debug Info Version", i32 3}
67!5 = !{i32 1, !"PIC Level", i32 2}
68!6 = !{!"clang version 4.0.0 (trunk 281293) (llvm/trunk 281290)"}
69!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)
70!8 = !DISubroutineType(types: !2)
71!9 = !DILocation(line: 5, column: 10, scope: !7)
72!10 = !DILocation(line: 5, column: 18, scope: !11)
73!11 = !DILexicalBlockFile(scope: !7, file: !1, discriminator: 1)
74!12 = !DILocation(line: 5, column: 16, scope: !7)
75!13 = !DILocation(line: 5, column: 3, scope: !7)
76!14 = !{!"function_entry_count", i64 30}