blob: 532e443e2170bd7fda17898ecdd17e2be0fbcef0 [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
Hal Finkelbdd67352016-10-04 18:13:45 +00004; RUN: opt < %s -S -inline -pass-remarks-with-hotness -pass-remarks-output=%t
5; RUN: cat %t | FileCheck -check-prefix=YAML %s
Adam Nemeta62b7e12016-09-27 20:55:07 +00006
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
Adam Nemet11421472016-09-27 21:58:17 +000016; 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)
Adam Nemeta62b7e12016-09-27 20:55:07 +000018
19; YAML: --- !Missed
20; YAML-NEXT: Pass: inline
Adam Nemet11421472016-09-27 21:58:17 +000021; YAML-NEXT: Name: NoDefinition
Adam Nemeta62b7e12016-09-27 20:55:07 +000022; 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
Adam Nemet0428e932016-10-04 17:05:04 +000027; YAML-NEXT: - String: ' will not be inlined into '
Adam Nemeta62b7e12016-09-27 20:55:07 +000028; YAML-NEXT: - Caller: baz
Adam Nemetb103fc52016-11-07 22:41:13 +000029; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 4, Column: 0 }
Adam Nemet0428e932016-10-04 17:05:04 +000030; YAML-NEXT: - String: ' because its definition is unavailable'
Adam Nemeta62b7e12016-09-27 20:55:07 +000031; YAML-NEXT: ...
32; YAML-NEXT: --- !Missed
33; YAML-NEXT: Pass: inline
Adam Nemet11421472016-09-27 21:58:17 +000034; YAML-NEXT: Name: NoDefinition
Adam Nemeta62b7e12016-09-27 20:55:07 +000035; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 5, Column: 18 }
36; YAML-NEXT: Function: baz
37; YAML-NEXT: Hotness: 30
38; YAML-NEXT: Args:
39; YAML-NEXT: - Callee: bar
Adam Nemet0428e932016-10-04 17:05:04 +000040; YAML-NEXT: - String: ' will not be inlined into '
Adam Nemeta62b7e12016-09-27 20:55:07 +000041; YAML-NEXT: - Caller: baz
Adam Nemetb103fc52016-11-07 22:41:13 +000042; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 4, Column: 0 }
Adam Nemet0428e932016-10-04 17:05:04 +000043; YAML-NEXT: - String: ' because its definition is unavailable'
Adam Nemeta62b7e12016-09-27 20:55:07 +000044; YAML-NEXT: ...
45
46; ModuleID = '/tmp/s.c'
47source_filename = "/tmp/s.c"
48target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
49target triple = "x86_64-apple-macosx10.11.0"
50
51; Function Attrs: nounwind ssp uwtable
Adam Nemet7da20c32016-11-10 17:47:03 +000052define i32 @"\01baz"() !dbg !7 !prof !14 {
Adam Nemeta62b7e12016-09-27 20:55:07 +000053entry:
54 %call = call i32 (...) @foo(), !dbg !9
Adam Nemetee5cf032016-10-08 04:47:20 +000055 %call1 = call i32 (...) @"\01bar"(), !dbg !10
Adam Nemeta62b7e12016-09-27 20:55:07 +000056 %add = add nsw i32 %call, %call1, !dbg !12
57 ret i32 %add, !dbg !13
58}
59
60declare i32 @foo(...)
61
Adam Nemetee5cf032016-10-08 04:47:20 +000062declare i32 @"\01bar"(...)
Adam Nemeta62b7e12016-09-27 20:55:07 +000063
64!llvm.dbg.cu = !{!0}
65!llvm.module.flags = !{!3, !4, !5}
66!llvm.ident = !{!6}
67
68!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)
69!1 = !DIFile(filename: "/tmp/s.c", directory: "/tmp")
70!2 = !{}
71!3 = !{i32 2, !"Dwarf Version", i32 4}
72!4 = !{i32 2, !"Debug Info Version", i32 3}
73!5 = !{i32 1, !"PIC Level", i32 2}
74!6 = !{!"clang version 4.0.0 (trunk 281293) (llvm/trunk 281290)"}
75!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)
76!8 = !DISubroutineType(types: !2)
77!9 = !DILocation(line: 5, column: 10, scope: !7)
78!10 = !DILocation(line: 5, column: 18, scope: !11)
79!11 = !DILexicalBlockFile(scope: !7, file: !1, discriminator: 1)
80!12 = !DILocation(line: 5, column: 16, scope: !7)
81!13 = !DILocation(line: 5, column: 3, scope: !7)
82!14 = !{!"function_entry_count", i64 30}