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