1; RUN: llc %s -enable-machine-outliner -mtriple=aarch64-unknown-unknown -pass-remarks=machine-outliner -pass-remarks-missed=machine-outliner -o /dev/null 2>&1 | FileCheck %s
2; CHECK: <unknown>:0:0:
3; CHECK-SAME: Did not outline 2 instructions from 2 locations.
4; CHECK-SAME: Bytes from outlining all occurrences (36) >=
5; CHECK-SAME: Unoutlined instruction bytes (16)
6; CHECK-SAME: (Also found at: <UNKNOWN LOCATION>)
7; CHECK: remark: <unknown>:0:0: Saved 20 bytes by outlining 12 instructions
8; CHECK-SAME: from 2 locations. (Found at: <UNKNOWN LOCATION>,
9; CHECK-SAME: <UNKNOWN LOCATION>)
10; RUN: llc %s -enable-machine-outliner -mtriple=aarch64-unknown-unknown -o /dev/null -pass-remarks-missed=machine-outliner -pass-remarks-output=%t.yaml
11; RUN: cat %t.yaml | FileCheck %s -check-prefix=YAML
12; YAML: --- !Missed
13; YAML-NEXT: Pass:            machine-outliner
14; YAML-NEXT: Name:            NotOutliningCheaper
15; YAML-NEXT: Function:        dog
16; YAML-NEXT: Args:
17; YAML-NEXT:   - String:          'Did not outline '
18; YAML-NEXT:   - Length:          '2'
19; YAML-NEXT:   - String:          ' instructions'
20; YAML-NEXT:   - String:          ' from '
21; YAML-NEXT:   - NumOccurrences:  '2'
22; YAML-NEXT:   - String:          ' locations.'
23; YAML-NEXT:   - String:          ' Bytes from outlining all occurrences ('
24; YAML-NEXT:   - OutliningCost:   '36'
25; YAML-NEXT:   - String:          ')'
26; YAML-NEXT:   - String:          ' >= Unoutlined instruction bytes ('
27; YAML-NEXT:   - NotOutliningCost: '16'
28; YAML-NEXT:   - String:          ')'
29; YAML-NEXT:   - String:          ' (Also found at: '
30; YAML-NEXT:   - OtherStartLoc1:  '<UNKNOWN LOCATION>'
31; YAML-NEXT:   - String:          ')'
32; YAML: --- !Passed
33; YAML-NEXT: Pass:            machine-outliner
34; YAML-NEXT: Name:            OutlinedFunction
35; YAML-NEXT: Function:        OUTLINED_FUNCTION_0
36; YAML-NEXT: Args:
37; YAML-NEXT:   - String:          'Saved '
38; YAML-NEXT:   - OutliningBenefit: '20'
39; YAML-NEXT:   - String:          ' bytes by '
40; YAML-NEXT:   - String:          'outlining '
41; YAML-NEXT:   - Length:          '12'
42; YAML-NEXT:   - String:          ' instructions '
43; YAML-NEXT:   - String:          'from '
44; YAML-NEXT:   - NumOccurrences:  '2'
45; YAML-NEXT:   - String:          ' locations. '
46; YAML-NEXT:   - String:          '(Found at: '
47; YAML-NEXT:   - StartLoc0:       '<UNKNOWN LOCATION>'
48; YAML-NEXT:   - String:          ', '
49; YAML-NEXT:   - StartLoc1:       '<UNKNOWN LOCATION>'
50; YAML-NEXT:   - String:          ')'
51
52define void @dog() #0 !dbg !8 {
53entry:
54  %x = alloca i32, align 4
55  %y = alloca i32, align 4
56  store i32 0, i32* %x, align 4
57  store i32 1, i32* %y, align 4, !dbg !12
58  ret void
59}
60
61define void @cat() #0 !dbg !14 {
62entry:
63  %x = alloca i32, align 4
64  %y = alloca i32, align 4
65  store i32 0, i32* %x, align 4
66  store i32 1, i32* %y, align 4, !dbg !16
67  ret void
68}
69
70define void @foo() #0 !dbg !18 {
71  %1 = alloca i32, align 4
72  %2 = alloca i32, align 4
73  %3 = alloca i32, align 4
74  %4 = alloca i32, align 4
75  %5 = alloca i32, align 4
76  %6 = alloca i32, align 4
77  store i32 1, i32* %1, align 4, !dbg !24
78  store i32 2, i32* %2, align 4
79  store i32 3, i32* %3, align 4
80  store i32 4, i32* %4, align 4
81  store i32 5, i32* %5, align 4
82  store i32 6, i32* %6, align 4, !dbg !26
83  ret void
84}
85
86define void @bar() #0 !dbg !27 {
87  %1 = alloca i32, align 4
88  %2 = alloca i32, align 4
89  %3 = alloca i32, align 4
90  %4 = alloca i32, align 4
91  %5 = alloca i32, align 4
92  %6 = alloca i32, align 4
93  store i32 1, i32* %1, align 4, !dbg !33
94  store i32 2, i32* %2, align 4
95  store i32 3, i32* %3, align 4
96  store i32 4, i32* %4, align 4
97  store i32 5, i32* %5, align 4
98  store i32 6, i32* %6, align 4, !dbg !35
99  ret void
100}
101
102attributes #0 = { noredzone nounwind ssp uwtable "no-frame-pointer-elim"="false" "target-cpu"="cyclone" }
103
104!llvm.dbg.cu = !{!0}
105!llvm.module.flags = !{!3, !4, !5, !6}
106!llvm.ident = !{!7}
107
108!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
109!1 = !DIFile(filename: "machine-outliner-remarks.ll", directory: "/tmp")
110!2 = !{}
111!3 = !{i32 2, !"Dwarf Version", i32 4}
112!4 = !{i32 2, !"Debug Info Version", i32 3}
113!5 = !{i32 1, !"wchar_size", i32 4}
114!6 = !{i32 7, !"PIC Level", i32 2}
115!7 = !{!""}
116!8 = distinct !DISubprogram(name: "dog", scope: !1, file: !1, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
117!9 = !DISubroutineType(types: !10)
118!10 = !{null}
119!12 = !DILocation(line: 5, column: 9, scope: !8)
120!14 = distinct !DISubprogram(name: "cat", scope: !1, file: !1, line: 10, type: !9, isLocal: false, isDefinition: true, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
121!16 = !DILocation(line: 13, column: 9, scope: !14)
122!18 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 26, type: !9, isLocal: false, isDefinition: true, scopeLine: 26, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
123!24 = !DILocation(line: 27, column: 9, scope: !18)
124!26 = !DILocation(line: 29, column: 9, scope: !18)
125!27 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 35, type: !9, isLocal: false, isDefinition: true, scopeLine: 35, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
126!33 = !DILocation(line: 36, column: 1, scope: !27)
127!35 = !DILocation(line: 38, column: 1, scope: !27)
128