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 reloads generated in loop{{$}}
21; (loop2:)
22; REMARK: remark: /tmp/kk.c:2:20: 1 spills 1 reloads generated in loop{{$}}
23; (loop:)
24; REMARK: remark: /tmp/kk.c:1:20: 2 spills 2 reloads generated in loop{{$}}
25
26; (loop3:)
27; HOTNESS: remark: /tmp/kk.c:3:20: 1 spills 1 reloads generated in loop (hotness: 300)
28; (loop2:)
29; HOTNESS: remark: /tmp/kk.c:2:20: 1 spills 1 reloads generated in loop (hotness: 30000)
30; (loop:)
31; HOTNESS: remark: /tmp/kk.c:1:20: 2 spills 2 reloads generated in loop (hotness: 300)
32
33; NO_REMARK-NOT: remark
34
35; THRESHOLD-NOT: (hotness: 300)
36; THRESHOLD: remark: /tmp/kk.c:2:20: 1 spills 1 reloads generated in loop (hotness: 30000)
37
38; YAML: --- !Missed
39; YAML: Pass:            regalloc
40; YAML: Name:            LoopSpillReload
41; YAML: DebugLoc:        { File: '/tmp/kk.c', Line: 3, Column: 20 }
42; YAML: Function:        fpr128
43; YAML: Hotness:         300
44; YAML: Args:
45; YAML:   - NumSpills:       '1'
46; YAML:   - String:          ' spills '
47; YAML:   - NumReloads:      '1'
48; YAML:   - String:          ' reloads '
49; YAML:   - String:          generated in loop
50; YAML: ...
51; YAML: --- !Missed
52; YAML: Pass:            regalloc
53; YAML: Name:            LoopSpillReload
54; YAML: DebugLoc:        { File: '/tmp/kk.c', Line: 2, Column: 20 }
55; YAML: Function:        fpr128
56; YAML: Hotness:         30000
57; YAML: Args:
58; YAML:   - NumSpills:       '1'
59; YAML:   - String:          ' spills '
60; YAML:   - NumReloads:      '1'
61; YAML:   - String:          ' reloads '
62; YAML:   - String:          generated in loop
63; YAML: ...
64; YAML: --- !Missed
65; YAML: Pass:            regalloc
66; YAML: Name:            LoopSpillReload
67; YAML: DebugLoc:        { File: '/tmp/kk.c', Line: 1, Column: 20 }
68; YAML: Function:        fpr128
69; YAML: Hotness:         300
70; YAML: Args:
71; YAML:   - NumSpills:       '2'
72; YAML:   - String:          ' spills '
73; YAML:   - NumReloads:      '2'
74; YAML:   - String:          ' reloads '
75; YAML:   - String:          generated in loop
76; YAML: ...
77
78; THRESHOLD_YAML-NOT: Hotness:         300{{$}}
79; THRESHOLD_YAML: --- !Missed
80; THRESHOLD_YAML: Pass:            regalloc
81; THRESHOLD_YAML: Name:            LoopSpillReload
82; THRESHOLD_YAML: DebugLoc:        { File: '/tmp/kk.c', Line: 2, Column: 20 }
83; THRESHOLD_YAML: Function:        fpr128
84; THRESHOLD_YAML: Hotness:         30000
85; THRESHOLD_YAML: Args:
86; THRESHOLD_YAML:   - NumSpills:       '1'
87; THRESHOLD_YAML:   - String:          ' spills '
88; THRESHOLD_YAML:   - NumReloads:      '1'
89; THRESHOLD_YAML:   - String:          ' reloads '
90; THRESHOLD_YAML:   - String:          generated in loop
91; THRESHOLD_YAML: ...
92
93define void @fpr128(<4 x float>* %p) nounwind ssp !prof !11 {
94entry:
95  br label %loop, !dbg !8
96
97loop:
98  %i = phi i32 [ 0, %entry], [ %i.2, %end2 ]
99  br label %loop2, !dbg !9
100
101loop2:
102  %j = phi i32 [ 0, %loop], [ %j.2, %loop2 ]
103  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
104  %j.2 = add i32 %j, 1
105  %c2 = icmp slt i32 %j.2, 100
106  br i1 %c2, label %loop2, label %end2, !prof !12
107
108end2:
109  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
110  %i.2 = add i32 %i, 1
111  %c = icmp slt i32 %i.2, 100
112  br i1 %c, label %loop, label %end, !prof !12
113
114end:
115  br label %loop3
116
117loop3:
118  %k = phi i32 [ 0, %end], [ %k.2, %loop3 ]
119  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
120  %k.2 = add i32 %k, 1
121  %c3 = icmp slt i32 %k.2, 100
122  br i1 %c3, label %loop3, label %end3, !dbg !10, !prof !12
123
124end3:
125  ret void
126}
127
128!llvm.dbg.cu = !{!0}
129!llvm.module.flags = !{!3, !4}
130!llvm.ident = !{!5}
131
132!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2)
133!1 = !DIFile(filename: "/tmp/kk.c", directory: "/tmp")
134!2 = !{}
135!3 = !{i32 2, !"Debug Info Version", i32 3}
136!4 = !{i32 1, !"PIC Level", i32 2}
137!5 = !{!"clang version 3.9.0 "}
138!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)
139!7 = !DISubroutineType(types: !2)
140!8 = !DILocation(line: 1, column: 20, scope: !6)
141!9 = !DILocation(line: 2, column: 20, scope: !6)
142!10 = !DILocation(line: 3, column: 20, scope: !6)
143!11 = !{!"function_entry_count", i64 3}
144!12 = !{!"branch_weights", i32 99, i32 1}
145