1; RUN: llc < %s -mtriple=arm64-apple-ios7.0 -aarch64-neon-syntax=apple -pass-remarks-missed=regalloc 2>&1 | FileCheck -check-prefix=REMARK %s
2; RUN: llc < %s -mtriple=arm64-apple-ios7.0 -aarch64-neon-syntax=apple -pass-remarks-missed=regalloc -pass-remarks-with-hotness 2>&1 | FileCheck -check-prefix=HOTNESS %s
3; RUN: llc < %s -mtriple=arm64-apple-ios7.0 -aarch64-neon-syntax=apple 2>&1 | FileCheck -check-prefix=NO_REMARK %s
4; RUN: llc < %s -mtriple=arm64-apple-ios7.0 -aarch64-neon-syntax=apple -pass-remarks-output=%t.yaml -pass-remarks-with-hotness 2>&1 | FileCheck -check-prefix=NO_REMARK %s
5; RUN: cat %t.yaml | FileCheck -check-prefix=YAML %s
6;
7; Verify that remarks below the hotness threshold are not output.
8; RUN: llc < %s -mtriple=arm64-apple-ios7.0 -aarch64-neon-syntax=apple -pass-remarks-missed=regalloc \
9; RUN:       -pass-remarks-with-hotness -pass-remarks-hotness-threshold=500 \
10; RUN:       2>&1 | FileCheck -check-prefix=THRESHOLD %s
11; RUN: llc < %s -mtriple=arm64-apple-ios7.0 -aarch64-neon-syntax=apple -pass-remarks-output=%t.threshold.yaml \
12; RUN:       -pass-remarks-with-hotness -pass-remarks-hotness-threshold=500 \
13; RUN:       2>&1 | FileCheck -check-prefix=NO_REMARK %s
14; RUN: cat %t.threshold.yaml | FileCheck -check-prefix=THRESHOLD_YAML %s
15
16; This has two nested loops, each with one value that has to be spilled and
17; then reloaded.
18
19; (loop3:)
20; REMARK: remark: /tmp/kk.c:3:20: 1 spills 1.000000e+02 total spills cost 1 reloads 1.000000e+02 total reloads cost generated in loop{{$}}
21; (loop2:)
22; REMARK: remark: /tmp/kk.c:2:20: 1 spills 1.000000e+04 total spills cost 1 reloads 1.000000e+04 total reloads cost generated in loop{{$}}
23; (loop:)
24; REMARK: remark: /tmp/kk.c:1:20: 2 spills 1.010000e+04 total spills cost 2 reloads 1.010000e+04 total reloads cost generated in loop{{$}}
25; (func:)
26; REMARK: remark: /tmp/kk.c:1:1: 3 spills 1.020000e+04 total spills cost 3 reloads 1.020000e+04 total reloads cost generated in function
27
28; (loop3:)
29; HOTNESS: remark: /tmp/kk.c:3:20: 1 spills 1.000000e+02 total spills cost 1 reloads 1.000000e+02 total reloads cost generated in loop (hotness: 300)
30; (loop2:)
31; HOTNESS: remark: /tmp/kk.c:2:20: 1 spills 1.000000e+04 total spills cost 1 reloads 1.000000e+04 total reloads cost generated in loop (hotness: 30000)
32; (loop:)
33; HOTNESS: remark: /tmp/kk.c:1:20: 2 spills 1.010000e+04 total spills cost 2 reloads 1.010000e+04 total reloads cost generated in loop (hotness: 300)
34
35; NO_REMARK-NOT: remark
36
37; THRESHOLD-NOT: (hotness: 300)
38; THRESHOLD: remark: /tmp/kk.c:2:20: 1 spills 1.000000e+04 total spills cost 1 reloads 1.000000e+04 total reloads cost generated in loop (hotness: 30000)
39
40; YAML: --- !Missed
41; YAML: Pass:            regalloc
42; YAML: Name:            LoopSpillReloadCopies
43; YAML: DebugLoc:        { File: '/tmp/kk.c', Line: 3, Column: 20 }
44; YAML: Function:        fpr128
45; YAML: Hotness:         300
46; YAML: Args:
47; YAML:   - NumSpills:       '1'
48; YAML:   - String:          ' spills '
49; YAML:   - TotalSpillsCost: '1.000000e+02'
50; YAML:   - String:          ' total spills cost '
51; YAML:   - NumReloads:      '1'
52; YAML:   - String:          ' reloads '
53; YAML:   - TotalReloadsCost: '1.000000e+02'
54; YAML:   - String:          ' total reloads cost '
55; YAML:   - String:          generated in loop
56; YAML: ...
57; YAML: --- !Missed
58; YAML: Pass:            regalloc
59; YAML: Name:            LoopSpillReloadCopies
60; YAML: DebugLoc:        { File: '/tmp/kk.c', Line: 2, Column: 20 }
61; YAML: Function:        fpr128
62; YAML: Hotness:         30000
63; YAML: Args:
64; YAML:   - NumSpills:       '1'
65; YAML:   - String:          ' spills '
66; YAML:   - TotalSpillsCost: '1.000000e+04'
67; YAML:   - String:          ' total spills cost '
68; YAML:   - NumReloads:      '1'
69; YAML:   - String:          ' reloads '
70; YAML:   - TotalReloadsCost: '1.000000e+04'
71; YAML:   - String:          ' total reloads cost '
72; YAML:   - String:          generated in loop
73; YAML: ...
74; YAML: --- !Missed
75; YAML: Pass:            regalloc
76; YAML: Name:            LoopSpillReloadCopies
77; YAML: DebugLoc:        { File: '/tmp/kk.c', Line: 1, Column: 20 }
78; YAML: Function:        fpr128
79; YAML: Hotness:         300
80; YAML: Args:
81; YAML:   - NumSpills:       '2'
82; YAML:   - String:          ' spills '
83; YAML:   - TotalSpillsCost: '1.010000e+04'
84; YAML:   - String:          ' total spills cost '
85; YAML:   - NumReloads:      '2'
86; YAML:   - String:          ' reloads '
87; YAML:   - TotalReloadsCost: '1.010000e+04'
88; YAML:   - String:          ' total reloads cost '
89; YAML:   - String:          generated in loop
90; YAML: ...
91; YAML: --- !Missed
92; YAML: Pass:            regalloc
93; YAML: Name:            SpillReloadCopies
94; YAML: DebugLoc:        { File: '/tmp/kk.c', Line: 1, Column: 1 }
95; YAML: Function:        fpr128
96; YAML: Hotness:         3
97; YAML: Args:
98; YAML:   - NumSpills:       '3'
99; YAML:   - String:          ' spills '
100; YAML:   - TotalSpillsCost: '1.020000e+04'
101; YAML:   - String:          ' total spills cost '
102; YAML:   - NumReloads:      '3'
103; YAML:   - String:          ' reloads '
104; YAML:   - TotalReloadsCost: '1.020000e+04'
105; YAML:   - String:          ' total reloads cost '
106; YAML:   - String:          generated in function
107; YAML: ...
108
109; THRESHOLD_YAML-NOT: Hotness:         300{{$}}
110; THRESHOLD_YAML: --- !Missed
111; THRESHOLD_YAML: Pass:            regalloc
112; THRESHOLD_YAML: Name:            LoopSpillReloadCopies
113; THRESHOLD_YAML: DebugLoc:        { File: '/tmp/kk.c', Line: 2, Column: 20 }
114; THRESHOLD_YAML: Function:        fpr128
115; THRESHOLD_YAML: Hotness:         30000
116; THRESHOLD_YAML: Args:
117; THRESHOLD_YAML:   - NumSpills:       '1'
118; THRESHOLD_YAML:   - String:          ' spills '
119; THRESHOLD_YAML:   - TotalSpillsCost: '1.000000e+04'
120; THRESHOLD_YAML:   - String:          ' total spills cost '
121; THRESHOLD_YAML:   - NumReloads:      '1'
122; THRESHOLD_YAML:   - String:          ' reloads '
123; THRESHOLD_YAML:   - TotalReloadsCost: '1.000000e+04'
124; THRESHOLD_YAML:   - String:          ' total reloads cost '
125; THRESHOLD_YAML:   - String:          generated in loop
126; THRESHOLD_YAML: ...
127
128define void @fpr128(<4 x float>* %p) nounwind ssp !prof !11 !dbg !6 {
129entry:
130  br label %loop, !dbg !8
131
132loop:
133  %i = phi i32 [ 0, %entry], [ %i.2, %end2 ]
134  br label %loop2, !dbg !9
135
136loop2:
137  %j = phi i32 [ 0, %loop], [ %j.2, %loop2 ]
138  call void asm sideeffect "; inlineasm", "~{q0},~{q1},~{q2},~{q3},~{q4},~{q5},~{q6},~{q7},~{q8},~{q9},~{q10},~{q11},~{q12},~{q13},~{q14},~{q15},~{q16},~{q17},~{q18},~{q19},~{q20},~{q21},~{q22},~{q23},~{q24},~{q25},~{q26},~{q27},~{q28},~{q29},~{q30},~{q31},~{x0},~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{fp},~{lr},~{sp},~{memory}"() nounwind
139  %j.2 = add i32 %j, 1
140  %c2 = icmp slt i32 %j.2, 100
141  br i1 %c2, label %loop2, label %end2, !prof !12
142
143end2:
144  call void asm sideeffect "; inlineasm", "~{q0},~{q1},~{q2},~{q3},~{q4},~{q5},~{q6},~{q7},~{q8},~{q9},~{q10},~{q11},~{q12},~{q13},~{q14},~{q15},~{q16},~{q17},~{q18},~{q19},~{q20},~{q21},~{q22},~{q23},~{q24},~{q25},~{q26},~{q27},~{q28},~{q29},~{q30},~{q31},~{x0},~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{fp},~{lr},~{sp},~{memory}"() nounwind
145  %i.2 = add i32 %i, 1
146  %c = icmp slt i32 %i.2, 100
147  br i1 %c, label %loop, label %end, !prof !12
148
149end:
150  br label %loop3
151
152loop3:
153  %k = phi i32 [ 0, %end], [ %k.2, %loop3 ]
154  call void asm sideeffect "; inlineasm", "~{q0},~{q1},~{q2},~{q3},~{q4},~{q5},~{q6},~{q7},~{q8},~{q9},~{q10},~{q11},~{q12},~{q13},~{q14},~{q15},~{q16},~{q17},~{q18},~{q19},~{q20},~{q21},~{q22},~{q23},~{q24},~{q25},~{q26},~{q27},~{q28},~{q29},~{q30},~{q31},~{x0},~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{fp},~{lr},~{sp},~{memory}"() nounwind
155  %k.2 = add i32 %k, 1
156  %c3 = icmp slt i32 %k.2, 100
157  br i1 %c3, label %loop3, label %end3, !dbg !10, !prof !12
158
159end3:
160  ret void
161}
162
163!llvm.dbg.cu = !{!0}
164!llvm.module.flags = !{!3, !4}
165!llvm.ident = !{!5}
166
167!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2)
168!1 = !DIFile(filename: "/tmp/kk.c", directory: "/tmp")
169!2 = !{}
170!3 = !{i32 2, !"Debug Info Version", i32 3}
171!4 = !{i32 1, !"PIC Level", i32 2}
172!5 = !{!"clang version 3.9.0 "}
173!6 = distinct !DISubprogram(name: "success", scope: !1, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)
174!7 = !DISubroutineType(types: !2)
175!8 = !DILocation(line: 1, column: 20, scope: !6)
176!9 = !DILocation(line: 2, column: 20, scope: !6)
177!10 = !DILocation(line: 3, column: 20, scope: !6)
178!11 = !{!"function_entry_count", i64 3}
179!12 = !{!"branch_weights", i32 99, i32 1}
180