blob: b3ee9faa1080dca5fcd0caedcc891ec8571a99dc [file] [log] [blame]
Adam Nemet04279092016-09-27 23:46:59 +00001; RUN: opt < %s -S -inline -pass-remarks-missed=inline -pass-remarks-with-hotness \
Adam Nemeta62b7e12016-09-27 20:55:07 +00002; 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 Nemet11421472016-09-27 21:58:17 +000014; 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 Nemeta62b7e12016-09-27 20:55:07 +000016
17; YAML: --- !Missed
18; YAML-NEXT: Pass: inline
Adam Nemet11421472016-09-27 21:58:17 +000019; YAML-NEXT: Name: NoDefinition
Adam Nemeta62b7e12016-09-27 20:55:07 +000020; 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 Nemet0428e932016-10-04 17:05:04 +000025; YAML-NEXT: - String: ' will not be inlined into '
Adam Nemeta62b7e12016-09-27 20:55:07 +000026; YAML-NEXT: - Caller: baz
Adam Nemet0428e932016-10-04 17:05:04 +000027; YAML-NEXT: - String: ' because its definition is unavailable'
Adam Nemeta62b7e12016-09-27 20:55:07 +000028; YAML-NEXT: ...
29; YAML-NEXT: --- !Missed
30; YAML-NEXT: Pass: inline
Adam Nemet11421472016-09-27 21:58:17 +000031; YAML-NEXT: Name: NoDefinition
Adam Nemeta62b7e12016-09-27 20:55:07 +000032; 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 Nemet0428e932016-10-04 17:05:04 +000037; YAML-NEXT: - String: ' will not be inlined into '
Adam Nemeta62b7e12016-09-27 20:55:07 +000038; YAML-NEXT: - Caller: baz
Adam Nemet0428e932016-10-04 17:05:04 +000039; YAML-NEXT: - String: ' because its definition is unavailable'
Adam Nemeta62b7e12016-09-27 20:55:07 +000040; YAML-NEXT: ...
41
42; ModuleID = '/tmp/s.c'
43source_filename = "/tmp/s.c"
44target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
45target triple = "x86_64-apple-macosx10.11.0"
46
47; Function Attrs: nounwind ssp uwtable
48define i32 @baz() !dbg !7 !prof !14 {
49entry:
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
56declare i32 @foo(...)
57
58declare 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}