1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-apple-macosx -regalloc=greedy | FileCheck %s
4 ; This testing case is reduced from 254.gap SyFgets function.
5 ; We make sure a spill is hoisted to a cold BB inside the hotter outer loop.
7 %struct.TMP.1 = type { %struct.TMP.2*, %struct.TMP.2*, [1024 x i8] }
8 %struct.TMP.2 = type { i8*, i32, i32, i16, i16, %struct.TMP.3, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.TMP.3, %struct.TMP.4*, i32, [3 x i8], [1 x i8], %struct.TMP.3, i32, i64 }
9 %struct.TMP.4 = type opaque
10 %struct.TMP.3 = type { i8*, i32 }
12 @syBuf = external global [16 x %struct.TMP.1], align 16
13 @syHistory = external global [8192 x i8], align 16
14 @SyFgets.yank = external global [512 x i8], align 16
15 @syCTRO = external global i32, align 4
17 define i8* @SyFgets(i8* %line, i64 %length, i64 %fid) {
18 ; CHECK-LABEL: SyFgets:
19 ; CHECK: ## %bb.0: ## %entry
20 ; CHECK-NEXT: pushq %rbp
21 ; CHECK-NEXT: .cfi_def_cfa_offset 16
22 ; CHECK-NEXT: pushq %r15
23 ; CHECK-NEXT: .cfi_def_cfa_offset 24
24 ; CHECK-NEXT: pushq %r14
25 ; CHECK-NEXT: .cfi_def_cfa_offset 32
26 ; CHECK-NEXT: pushq %r13
27 ; CHECK-NEXT: .cfi_def_cfa_offset 40
28 ; CHECK-NEXT: pushq %r12
29 ; CHECK-NEXT: .cfi_def_cfa_offset 48
30 ; CHECK-NEXT: pushq %rbx
31 ; CHECK-NEXT: .cfi_def_cfa_offset 56
32 ; CHECK-NEXT: subq $552, %rsp ## imm = 0x228
33 ; CHECK-NEXT: .cfi_def_cfa_offset 608
34 ; CHECK-NEXT: .cfi_offset %rbx, -56
35 ; CHECK-NEXT: .cfi_offset %r12, -48
36 ; CHECK-NEXT: .cfi_offset %r13, -40
37 ; CHECK-NEXT: .cfi_offset %r14, -32
38 ; CHECK-NEXT: .cfi_offset %r15, -24
39 ; CHECK-NEXT: .cfi_offset %rbp, -16
40 ; CHECK-NEXT: testq $-3, %rdx
41 ; CHECK-NEXT: jne LBB0_4
42 ; CHECK-NEXT: ## %bb.1: ## %if.end
43 ; CHECK-NEXT: xorl %eax, %eax
44 ; CHECK-NEXT: testb %al, %al
45 ; CHECK-NEXT: jne LBB0_5
46 ; CHECK-NEXT: ## %bb.2: ## %if.then4
47 ; CHECK-NEXT: xorl %eax, %eax
48 ; CHECK-NEXT: testb %al, %al
49 ; CHECK-NEXT: je LBB0_55
50 ; CHECK-NEXT: ## %bb.3: ## %SyTime.exit
51 ; CHECK-NEXT: xorl %eax, %eax
52 ; CHECK-NEXT: testb %al, %al
53 ; CHECK-NEXT: je LBB0_55
54 ; CHECK-NEXT: LBB0_4: ## %cleanup
55 ; CHECK-NEXT: addq $552, %rsp ## imm = 0x228
56 ; CHECK-NEXT: popq %rbx
57 ; CHECK-NEXT: popq %r12
58 ; CHECK-NEXT: popq %r13
59 ; CHECK-NEXT: popq %r14
60 ; CHECK-NEXT: popq %r15
61 ; CHECK-NEXT: popq %rbp
63 ; CHECK-NEXT: LBB0_5: ## %if.end25
64 ; CHECK-NEXT: xorl %eax, %eax
65 ; CHECK-NEXT: testb %al, %al
66 ; CHECK-NEXT: je LBB0_55
67 ; CHECK-NEXT: ## %bb.6: ## %SyTime.exit2720
68 ; CHECK-NEXT: movq %rdx, %rbx
69 ; CHECK-NEXT: movq %rdi, %rbp
70 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rax
71 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
72 ; CHECK-NEXT: cmpq %rax, %rcx
73 ; CHECK-NEXT: jae LBB0_8
74 ; CHECK-NEXT: ## %bb.7: ## %for.body.lr.ph
75 ; CHECK-NEXT: movl $512, %edx ## imm = 0x200
76 ; CHECK-NEXT: movl $32, %esi
77 ; CHECK-NEXT: callq _memset
78 ; CHECK-NEXT: LBB0_8: ## %while.body.preheader
79 ; CHECK-NEXT: imulq $1040, %rbx, %rax ## imm = 0x410
80 ; CHECK-NEXT: movq _syBuf@GOTPCREL(%rip), %rcx
81 ; CHECK-NEXT: leaq 8(%rcx,%rax), %rdx
82 ; CHECK-NEXT: movl $1, %r15d
83 ; CHECK-NEXT: movq _syCTRO@GOTPCREL(%rip), %rax
84 ; CHECK-NEXT: movb $1, %cl
85 ; CHECK-NEXT: .p2align 4, 0x90
86 ; CHECK-NEXT: LBB0_9: ## %do.body
87 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
88 ; CHECK-NEXT: movl $0, (%rax)
89 ; CHECK-NEXT: testb %cl, %cl
90 ; CHECK-NEXT: jne LBB0_9
91 ; CHECK-NEXT: ## %bb.10: ## %do.end
92 ; CHECK-NEXT: movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) ## 8-byte Spill
93 ; CHECK-NEXT: movq %rbp, {{[-0-9]+}}(%r{{[sb]}}p) ## 8-byte Spill
94 ; CHECK-NEXT: xorl %r13d, %r13d
95 ; CHECK-NEXT: testb %r13b, %r13b
96 ; CHECK-NEXT: jne LBB0_11
97 ; CHECK-NEXT: ## %bb.12: ## %while.body200.preheader
98 ; CHECK-NEXT: xorl %r12d, %r12d
99 ; CHECK-NEXT: leaq LJTI0_0(%rip), %rdx
100 ; CHECK-NEXT: leaq LJTI0_1(%rip), %rbx
101 ; CHECK-NEXT: movl $0, {{[-0-9]+}}(%r{{[sb]}}p) ## 4-byte Folded Spill
102 ; CHECK-NEXT: xorl %r14d, %r14d
103 ; CHECK-NEXT: jmp LBB0_13
104 ; CHECK-NEXT: .p2align 4, 0x90
105 ; CHECK-NEXT: LBB0_20: ## %sw.bb256
106 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
107 ; CHECK-NEXT: movl %r13d, %r14d
108 ; CHECK-NEXT: LBB0_21: ## %while.cond197.backedge
109 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
110 ; CHECK-NEXT: decl %r15d
111 ; CHECK-NEXT: testl %r15d, %r15d
112 ; CHECK-NEXT: movl %r14d, %r13d
113 ; CHECK-NEXT: jle LBB0_22
114 ; CHECK-NEXT: LBB0_13: ## %while.body200
115 ; CHECK-NEXT: ## =>This Loop Header: Depth=1
116 ; CHECK-NEXT: ## Child Loop BB0_29 Depth 2
117 ; CHECK-NEXT: ## Child Loop BB0_38 Depth 2
118 ; CHECK-NEXT: leal -268(%r13), %eax
119 ; CHECK-NEXT: cmpl $105, %eax
120 ; CHECK-NEXT: ja LBB0_14
121 ; CHECK-NEXT: ## %bb.56: ## %while.body200
122 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
123 ; CHECK-NEXT: movslq (%rbx,%rax,4), %rax
124 ; CHECK-NEXT: addq %rbx, %rax
125 ; CHECK-NEXT: jmpq *%rax
126 ; CHECK-NEXT: LBB0_44: ## %while.cond1037.preheader
127 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
128 ; CHECK-NEXT: testb %r12b, %r12b
129 ; CHECK-NEXT: movl %r13d, %r14d
130 ; CHECK-NEXT: jne LBB0_21
131 ; CHECK-NEXT: jmp LBB0_55
132 ; CHECK-NEXT: .p2align 4, 0x90
133 ; CHECK-NEXT: LBB0_14: ## %while.body200
134 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
135 ; CHECK-NEXT: leal 1(%r13), %eax
136 ; CHECK-NEXT: cmpl $21, %eax
137 ; CHECK-NEXT: ja LBB0_20
138 ; CHECK-NEXT: ## %bb.15: ## %while.body200
139 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
140 ; CHECK-NEXT: movl $-1, %r14d
141 ; CHECK-NEXT: movslq (%rdx,%rax,4), %rax
142 ; CHECK-NEXT: addq %rdx, %rax
143 ; CHECK-NEXT: jmpq *%rax
144 ; CHECK-NEXT: LBB0_18: ## %while.cond201.preheader
145 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
146 ; CHECK-NEXT: movl $1, %r14d
147 ; CHECK-NEXT: jmp LBB0_21
148 ; CHECK-NEXT: LBB0_26: ## %sw.bb474
149 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
150 ; CHECK-NEXT: testb %r12b, %r12b
151 ; CHECK-NEXT: ## implicit-def: $rbp
152 ; CHECK-NEXT: jne LBB0_34
153 ; CHECK-NEXT: ## %bb.27: ## %do.body479.preheader
154 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
155 ; CHECK-NEXT: testb %r12b, %r12b
156 ; CHECK-NEXT: ## implicit-def: $rbp
157 ; CHECK-NEXT: jne LBB0_34
158 ; CHECK-NEXT: ## %bb.28: ## %land.rhs485.preheader
159 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
160 ; CHECK-NEXT: ## implicit-def: $rax
161 ; CHECK-NEXT: jmp LBB0_29
162 ; CHECK-NEXT: .p2align 4, 0x90
163 ; CHECK-NEXT: LBB0_32: ## %do.body479.backedge
164 ; CHECK-NEXT: ## in Loop: Header=BB0_29 Depth=2
165 ; CHECK-NEXT: leaq 1(%rbp), %rax
166 ; CHECK-NEXT: testb %r12b, %r12b
167 ; CHECK-NEXT: je LBB0_33
168 ; CHECK-NEXT: LBB0_29: ## %land.rhs485
169 ; CHECK-NEXT: ## Parent Loop BB0_13 Depth=1
170 ; CHECK-NEXT: ## => This Inner Loop Header: Depth=2
171 ; CHECK-NEXT: testb %al, %al
172 ; CHECK-NEXT: js LBB0_55
173 ; CHECK-NEXT: ## %bb.30: ## %cond.true.i.i2780
174 ; CHECK-NEXT: ## in Loop: Header=BB0_29 Depth=2
175 ; CHECK-NEXT: movq %rax, %rbp
176 ; CHECK-NEXT: testb %r12b, %r12b
177 ; CHECK-NEXT: jne LBB0_32
178 ; CHECK-NEXT: ## %bb.31: ## %lor.rhs500
179 ; CHECK-NEXT: ## in Loop: Header=BB0_29 Depth=2
180 ; CHECK-NEXT: movl $256, %esi ## imm = 0x100
181 ; CHECK-NEXT: callq ___maskrune
182 ; CHECK-NEXT: testb %r12b, %r12b
183 ; CHECK-NEXT: jne LBB0_32
184 ; CHECK-NEXT: jmp LBB0_34
185 ; CHECK-NEXT: LBB0_45: ## %sw.bb1134
186 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
187 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rax
188 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
189 ; CHECK-NEXT: cmpq %rax, %rcx
190 ; CHECK-NEXT: jb LBB0_55
191 ; CHECK-NEXT: ## %bb.46: ## in Loop: Header=BB0_13 Depth=1
192 ; CHECK-NEXT: movl $0, {{[-0-9]+}}(%r{{[sb]}}p) ## 4-byte Folded Spill
193 ; CHECK-NEXT: movl $268, %r14d ## imm = 0x10C
194 ; CHECK-NEXT: jmp LBB0_21
195 ; CHECK-NEXT: LBB0_40: ## %sw.bb566
196 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
197 ; CHECK-NEXT: movl $20, %r14d
198 ; CHECK-NEXT: jmp LBB0_21
199 ; CHECK-NEXT: LBB0_19: ## %sw.bb243
200 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
201 ; CHECK-NEXT: movl $2, %r14d
202 ; CHECK-NEXT: jmp LBB0_21
203 ; CHECK-NEXT: LBB0_33: ## %if.end517.loopexitsplit
204 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
205 ; CHECK-NEXT: incq %rbp
206 ; CHECK-NEXT: LBB0_34: ## %if.end517
207 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
208 ; CHECK-NEXT: leal -324(%r14), %eax
209 ; CHECK-NEXT: cmpl $59, %eax
210 ; CHECK-NEXT: ja LBB0_35
211 ; CHECK-NEXT: ## %bb.57: ## %if.end517
212 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
213 ; CHECK-NEXT: movabsq $576460756598390785, %rcx ## imm = 0x800000100000001
214 ; CHECK-NEXT: btq %rax, %rcx
215 ; CHECK-NEXT: jb LBB0_38
216 ; CHECK-NEXT: LBB0_35: ## %if.end517
217 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
218 ; CHECK-NEXT: cmpl $11, %r14d
219 ; CHECK-NEXT: je LBB0_38
220 ; CHECK-NEXT: ## %bb.36: ## %if.end517
221 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
222 ; CHECK-NEXT: cmpl $24, %r14d
223 ; CHECK-NEXT: je LBB0_38
224 ; CHECK-NEXT: ## %bb.37: ## %if.then532
225 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
226 ; CHECK-NEXT: movq _SyFgets.yank@GOTPCREL(%rip), %rax
227 ; CHECK-NEXT: movb $0, (%rax)
228 ; CHECK-NEXT: .p2align 4, 0x90
229 ; CHECK-NEXT: LBB0_38: ## %for.cond534
230 ; CHECK-NEXT: ## Parent Loop BB0_13 Depth=1
231 ; CHECK-NEXT: ## => This Inner Loop Header: Depth=2
232 ; CHECK-NEXT: testb %r12b, %r12b
233 ; CHECK-NEXT: jne LBB0_38
234 ; CHECK-NEXT: ## %bb.39: ## %for.cond542.preheader
235 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
236 ; CHECK-NEXT: testb %r12b, %r12b
237 ; CHECK-NEXT: movb $0, (%rbp)
238 ; CHECK-NEXT: movl %r13d, %r14d
239 ; CHECK-NEXT: leaq LJTI0_0(%rip), %rdx
240 ; CHECK-NEXT: jmp LBB0_21
241 ; CHECK-NEXT: .p2align 4, 0x90
242 ; CHECK-NEXT: LBB0_42: ## %while.cond864
243 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
244 ; CHECK-NEXT: jmp LBB0_42
245 ; CHECK-NEXT: .p2align 4, 0x90
246 ; CHECK-NEXT: LBB0_43: ## %while.cond962
247 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
248 ; CHECK-NEXT: jmp LBB0_43
249 ; CHECK-NEXT: .p2align 4, 0x90
250 ; CHECK-NEXT: LBB0_25: ## %for.cond357
251 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
252 ; CHECK-NEXT: jmp LBB0_25
253 ; CHECK-NEXT: LBB0_11:
254 ; CHECK-NEXT: movl $0, {{[-0-9]+}}(%r{{[sb]}}p) ## 4-byte Folded Spill
255 ; CHECK-NEXT: xorl %r14d, %r14d
256 ; CHECK-NEXT: LBB0_22: ## %while.end1465
257 ; CHECK-NEXT: incl %r14d
258 ; CHECK-NEXT: cmpl $16, %r14d
259 ; CHECK-NEXT: ja LBB0_50
260 ; CHECK-NEXT: ## %bb.23: ## %while.end1465
261 ; CHECK-NEXT: movl $83969, %eax ## imm = 0x14801
262 ; CHECK-NEXT: btl %r14d, %eax
263 ; CHECK-NEXT: jae LBB0_50
264 ; CHECK-NEXT: ## %bb.24:
265 ; CHECK-NEXT: xorl %ebp, %ebp
266 ; CHECK-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx ## 8-byte Reload
267 ; CHECK-NEXT: LBB0_48: ## %if.then1477
268 ; CHECK-NEXT: movl $1, %edx
269 ; CHECK-NEXT: callq _write
270 ; CHECK-NEXT: subq %rbp, %rbx
271 ; CHECK-NEXT: movq _syHistory@GOTPCREL(%rip), %rax
272 ; CHECK-NEXT: leaq 8189(%rbx,%rax), %rax
273 ; CHECK-NEXT: .p2align 4, 0x90
274 ; CHECK-NEXT: LBB0_49: ## %for.body1723
275 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
276 ; CHECK-NEXT: decq %rax
277 ; CHECK-NEXT: jmp LBB0_49
278 ; CHECK-NEXT: LBB0_47: ## %if.then1477.loopexit
279 ; CHECK-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx ## 8-byte Reload
280 ; CHECK-NEXT: movq %rbx, %rbp
281 ; CHECK-NEXT: jmp LBB0_48
282 ; CHECK-NEXT: LBB0_16: ## %while.cond635.preheader
283 ; CHECK-NEXT: xorl %eax, %eax
284 ; CHECK-NEXT: testb %al, %al
285 ; CHECK-NEXT: je LBB0_41
286 ; CHECK-NEXT: .p2align 4, 0x90
287 ; CHECK-NEXT: LBB0_17: ## %for.body643.us
288 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
289 ; CHECK-NEXT: jmp LBB0_17
290 ; CHECK-NEXT: .p2align 4, 0x90
291 ; CHECK-NEXT: LBB0_41: ## %while.cond661
292 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
293 ; CHECK-NEXT: jmp LBB0_41
294 ; CHECK-NEXT: LBB0_50: ## %for.cond1480.preheader
295 ; CHECK-NEXT: movl $512, %eax ## imm = 0x200
296 ; CHECK-NEXT: cmpq %rax, %rax
297 ; CHECK-NEXT: jae LBB0_55
298 ; CHECK-NEXT: ## %bb.51: ## %for.body1664.lr.ph
299 ; CHECK-NEXT: xorl %eax, %eax
300 ; CHECK-NEXT: testb %al, %al
301 ; CHECK-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx ## 8-byte Reload
302 ; CHECK-NEXT: movl {{[-0-9]+}}(%r{{[sb]}}p), %ebp ## 4-byte Reload
303 ; CHECK-NEXT: jne LBB0_54
304 ; CHECK-NEXT: ## %bb.52: ## %while.body1679.preheader
305 ; CHECK-NEXT: incl %ebp
306 ; CHECK-NEXT: .p2align 4, 0x90
307 ; CHECK-NEXT: LBB0_53: ## %while.body1679
308 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
309 ; CHECK-NEXT: movq (%rbx), %rdi
310 ; CHECK-NEXT: callq _fileno
311 ; CHECK-NEXT: movslq %ebp, %rax
312 ; CHECK-NEXT: leal 1(%rax), %ebp
313 ; CHECK-NEXT: cmpq %rax, %rax
314 ; CHECK-NEXT: jl LBB0_53
315 ; CHECK-NEXT: LBB0_54: ## %while.cond1683.preheader
316 ; CHECK-NEXT: xorl %eax, %eax
317 ; CHECK-NEXT: testb %al, %al
318 ; CHECK-NEXT: LBB0_55: ## %if.then.i
321 %sub.ptr.rhs.cast646 = ptrtoint i8* %line to i64
322 %old = alloca [512 x i8], align 16
323 %0 = getelementptr inbounds [512 x i8], [512 x i8]* %old, i64 0, i64 0
324 switch i64 %fid, label %if.then [
333 switch i64 undef, label %if.end25 [
334 i64 0, label %if.then4
335 i64 1, label %if.end25
339 br i1 undef, label %SyTime.exit, label %if.then.i
345 br i1 undef, label %SyTime.exit2681, label %if.then.i2673
357 br i1 undef, label %SyTime.exit2720, label %if.then.i2712
363 %add.ptr = getelementptr [512 x i8], [512 x i8]* %old, i64 0, i64 512
364 %cmp293427 = icmp ult i8* %0, %add.ptr
365 br i1 %cmp293427, label %for.body.lr.ph, label %while.body.preheader
368 call void @llvm.memset.p0i8.i64(i8* align 16 undef, i8 32, i64 512, i1 false)
369 br label %while.body.preheader
371 while.body.preheader:
372 %add.ptr1603 = getelementptr [512 x i8], [512 x i8]* null, i64 0, i64 512
373 %echo.i3101 = getelementptr [16 x %struct.TMP.1], [16 x %struct.TMP.1]* @syBuf, i64 0, i64 %fid, i32 1
374 %1 = xor i64 %sub.ptr.rhs.cast646, -1
378 %ch2.0 = phi i32 [ 0, %while.body.preheader ], [ %ch.12.ch2.12, %do.body ]
379 %rep.0 = phi i32 [ 1, %while.body.preheader ], [ %rep.6, %do.body ]
380 store i32 0, i32* @syCTRO, align 4, !tbaa !1
381 %ch.0.ch2.0 = select i1 undef, i32 14, i32 %ch2.0
382 %ch2.2 = select i1 undef, i32 0, i32 %ch.0.ch2.0
383 %ch.2.ch2.2 = select i1 undef, i32 0, i32 %ch2.2
384 %ch2.4 = select i1 undef, i32 278, i32 %ch.2.ch2.2
385 %ch2.5 = select i1 undef, i32 0, i32 %ch2.4
386 %rep.2 = select i1 undef, i32 undef, i32 %rep.0
387 %ch.5.ch2.5 = select i1 undef, i32 undef, i32 %ch2.5
388 %ch2.7 = select i1 undef, i32 0, i32 %ch.5.ch2.5
389 %rep.3 = select i1 undef, i32 undef, i32 %rep.2
390 %ch.7.ch2.7 = select i1 false, i32 0, i32 %ch2.7
391 %mul98.rep.3 = select i1 false, i32 0, i32 %rep.3
392 %ch2.9 = select i1 undef, i32 undef, i32 %ch.7.ch2.7
393 %rep.5 = select i1 undef, i32 undef, i32 %mul98.rep.3
394 %ch2.10 = select i1 false, i32 undef, i32 %ch2.9
395 %rep.6 = select i1 false, i32 undef, i32 %rep.5
396 %isdigittmp = add i32 %ch2.10, -48
397 %isdigit = icmp ult i32 %isdigittmp, 10
398 %cmp119 = icmp eq i32 undef, 22
399 %or.cond1875 = and i1 %isdigit, %cmp119
400 %ch.10.ch2.10 = select i1 %or.cond1875, i32 undef, i32 %ch2.10
401 %.ch.10 = select i1 %or.cond1875, i32 0, i32 undef
402 %ch2.12 = select i1 undef, i32 %.ch.10, i32 %ch.10.ch2.10
403 %ch.12 = select i1 undef, i32 0, i32 %.ch.10
404 %ch.12.ch2.12 = select i1 false, i32 %ch.12, i32 %ch2.12
405 %.ch.12 = select i1 false, i32 0, i32 %ch.12
406 %cmp147 = icmp eq i32 %.ch.12, 0
407 br i1 %cmp147, label %do.body, label %do.end
410 %cmp164 = icmp eq i32 %ch.12.ch2.12, 21
411 %mul167 = shl i32 %rep.6, 2
412 %rep.8 = select i1 %cmp164, i32 %mul167, i32 %rep.6
413 %..ch.19 = select i1 false, i32 2, i32 0
414 br i1 undef, label %while.body200, label %while.end1465
417 %dec3386.in = phi i32 [ %dec3386, %while.cond197.backedge ], [ %rep.8, %do.end ]
418 %oldc.13384 = phi i32 [ %oldc.1.be, %while.cond197.backedge ], [ 0, %do.end ]
419 %ch.213379 = phi i32 [ %last.1.be, %while.cond197.backedge ], [ %..ch.19, %do.end ]
420 %last.13371 = phi i32 [ %last.1.be, %while.cond197.backedge ], [ 0, %do.end ]
421 %dec3386 = add i32 %dec3386.in, -1
422 switch i32 %ch.213379, label %sw.default [
423 i32 1, label %while.cond201.preheader
424 i32 322, label %sw.bb206
425 i32 354, label %sw.bb206
426 i32 2, label %sw.bb243
427 i32 364, label %sw.bb1077
428 i32 326, label %sw.bb256
429 i32 358, label %sw.bb256
430 i32 341, label %sw.bb979
431 i32 323, label %while.cond1037.preheader
432 i32 373, label %sw.bb979
433 i32 4, label %if.then1477
434 i32 332, label %sw.bb1077
435 i32 11, label %for.cond357
436 i32 355, label %while.cond1037.preheader
437 i32 324, label %sw.bb474
438 i32 356, label %sw.bb474
439 i32 20, label %sw.bb566
440 i32 -1, label %while.cond197.backedge
441 i32 268, label %sw.bb1134
442 i32 16, label %while.cond635.preheader
443 i32 18, label %sw.bb956
444 i32 316, label %while.cond864
447 while.cond1037.preheader:
448 %cmp10393273 = icmp eq i8 undef, 0
449 br i1 %cmp10393273, label %if.end1070, label %land.rhs1041
451 while.cond635.preheader:
452 br i1 undef, label %for.body643.us, label %while.cond661
455 br label %for.body643.us
457 while.cond201.preheader:
458 %umax = select i1 false, i64 undef, i64 %1
459 %2 = xor i64 %umax, -1
460 %3 = inttoptr i64 %2 to i8*
461 br label %while.cond197.backedge
464 br label %while.cond197.backedge
467 br label %while.cond197.backedge
470 br label %while.cond197.backedge
472 while.cond197.backedge:
473 %last.1.be = phi i32 [ %ch.213379, %sw.default ], [ -1, %while.body200 ], [ %ch.213379, %sw.bb1077 ], [ %ch.213379, %sw.bb979 ], [ 18, %sw.bb956 ], [ 20, %sw.bb566 ], [ %ch.213379, %for.end552 ], [ %ch.213379, %sw.bb256 ], [ 2, %sw.bb243 ], [ 1, %while.cond201.preheader ], [ 268, %for.cond1145.preheader ], [ %ch.213379, %sw.bb206 ]
474 %oldc.1.be = phi i32 [ %oldc.13384, %sw.default ], [ %oldc.13384, %while.body200 ], [ %oldc.13384, %sw.bb1077 ], [ %oldc.13384, %sw.bb979 ], [ %oldc.13384, %sw.bb956 ], [ %oldc.13384, %sw.bb566 ], [ %oldc.13384, %for.end552 ], [ %oldc.13384, %sw.bb256 ], [ %oldc.13384, %sw.bb243 ], [ %oldc.13384, %while.cond201.preheader ], [ 0, %for.cond1145.preheader ], [ %oldc.13384, %sw.bb206 ]
475 %cmp198 = icmp sgt i32 %dec3386, 0
476 br i1 %cmp198, label %while.body200, label %while.end1465
479 br label %for.cond357
482 ; spill is hoisted here. Although loop depth1 is even hotter than loop depth2, sw.bb474 is still cold.
483 %cmp476 = icmp eq i8 undef, 0
484 br i1 %cmp476, label %if.end517, label %do.body479.preheader
486 do.body479.preheader:
487 %cmp4833314 = icmp eq i8 undef, 0
488 br i1 %cmp4833314, label %if.end517, label %land.rhs485
491 %incdec.ptr4803316 = phi i8* [ %incdec.ptr480, %do.body479.backedge.land.rhs485_crit_edge ], [ undef, %do.body479.preheader ]
492 %isascii.i.i27763151 = icmp sgt i8 undef, -1
493 br i1 %isascii.i.i27763151, label %cond.true.i.i2780, label %cond.false.i.i2782
496 br i1 undef, label %land.lhs.true490, label %lor.rhs500
502 br i1 false, label %lor.rhs500, label %do.body479.backedge
505 ; Make sure spill is hoisted to a cold preheader in outside loop.
506 %call3.i.i2792 = call i32 @__maskrune(i32 undef, i64 256)
507 br i1 undef, label %land.lhs.true504, label %do.body479.backedge
510 br i1 undef, label %do.body479.backedge, label %if.end517
513 %incdec.ptr480 = getelementptr i8, i8* %incdec.ptr4803316, i64 1
514 %cmp483 = icmp eq i8 undef, 0
515 br i1 %cmp483, label %if.end517, label %do.body479.backedge.land.rhs485_crit_edge
517 do.body479.backedge.land.rhs485_crit_edge:
518 br label %land.rhs485
521 %q.4 = phi i8* [ undef, %sw.bb474 ], [ undef, %do.body479.preheader ], [ %incdec.ptr480, %do.body479.backedge ], [ %incdec.ptr4803316, %land.lhs.true504 ]
522 switch i32 %last.13371, label %if.then532 [
523 i32 383, label %for.cond534
524 i32 356, label %for.cond534
525 i32 324, label %for.cond534
526 i32 24, label %for.cond534
527 i32 11, label %for.cond534
531 store i8 0, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @SyFgets.yank, i64 0, i64 0), align 16, !tbaa !5
532 br label %for.cond534
535 %cmp536 = icmp eq i8 undef, 0
536 br i1 %cmp536, label %for.cond542.preheader, label %for.cond534
538 for.cond542.preheader:
539 br i1 undef, label %for.body545, label %for.end552
542 br i1 undef, label %for.end552, label %for.body545
545 %s.2.lcssa = phi i8* [ undef, %for.cond542.preheader ], [ %q.4, %for.body545 ]
546 %sub.ptr.lhs.cast553 = ptrtoint i8* %s.2.lcssa to i64
547 %sub.ptr.sub555 = sub i64 %sub.ptr.lhs.cast553, 0
548 %arrayidx556 = getelementptr i8, i8* null, i64 %sub.ptr.sub555
549 store i8 0, i8* %arrayidx556, align 1, !tbaa !5
550 br label %while.cond197.backedge
553 br label %while.cond197.backedge
556 br label %while.cond661
559 br label %while.cond864
562 br i1 undef, label %if.then959, label %while.cond197.backedge
565 br label %while.cond962
568 br label %while.cond962
571 br label %while.cond197.backedge
580 br label %while.cond197.backedge
583 br i1 false, label %for.body1139, label %for.cond1145.preheader
585 for.cond1145.preheader:
586 br i1 %cmp293427, label %for.body1150.lr.ph, label %while.cond197.backedge
595 br label %while.cond197.backedge
598 %oldc.1.lcssa = phi i32 [ 0, %do.end ], [ %oldc.1.be, %while.cond197.backedge ]
599 %ch.21.lcssa = phi i32 [ %..ch.19, %do.end ], [ %last.1.be, %while.cond197.backedge ]
600 switch i32 %ch.21.lcssa, label %for.cond1480.preheader [
601 i32 -1, label %if.then1477
602 i32 15, label %if.then1477
603 i32 13, label %if.then1477
604 i32 10, label %if.then1477
607 for.cond1480.preheader:
608 br i1 undef, label %for.body1606.lr.ph, label %for.end1609
611 %p.1.lcssa3539 = phi i8* [ null, %while.end1465 ], [ null, %while.end1465 ], [ null, %while.end1465 ], [ null, %while.end1465 ], [ %line, %while.body200 ]
612 %call1.i3057 = call i64 @"\01_write"(i32 undef, i8* undef, i64 1)
613 %sub.ptr.lhs.cast1717 = ptrtoint i8* %p.1.lcssa3539 to i64
614 %sub.ptr.sub1719 = sub i64 %sub.ptr.lhs.cast1717, %sub.ptr.rhs.cast646
615 %idx.neg1727 = sub i64 0, %sub.ptr.sub1719
616 br label %for.body1723
619 br label %for.end1609
622 br i1 undef, label %for.cond1659.preheader, label %land.lhs.true1614
625 br label %for.cond1659.preheader
627 for.cond1659.preheader:
628 %cmp16623414 = icmp ult i8* undef, %add.ptr1603
629 br i1 %cmp16623414, label %for.body1664.lr.ph, label %while.body1703.lr.ph
632 %cmp16773405 = icmp slt i64 undef, undef
633 br i1 %cmp16773405, label %while.body1679, label %while.cond1683.preheader
635 while.body1703.lr.ph:
638 while.cond1683.preheader:
639 br i1 undef, label %while.body1691, label %while.end1693
642 %oldc.43406 = phi i32 [ %inc, %syEchoch.exit3070 ], [ %oldc.1.lcssa, %for.body1664.lr.ph ]
643 %4 = load %struct.TMP.2*, %struct.TMP.2** %echo.i3101, align 8, !tbaa !6
644 %call.i3062 = call i32 @fileno(%struct.TMP.2* %4)
645 br i1 undef, label %if.then.i3069, label %syEchoch.exit3070
648 br label %syEchoch.exit3070
651 %inc = add i32 %oldc.43406, 1
652 %conv1672 = sext i32 %inc to i64
653 %cmp1677 = icmp slt i64 %conv1672, undef
654 br i1 %cmp1677, label %while.body1679, label %while.cond1683.preheader
663 %q.303203 = phi i8* [ getelementptr inbounds ([8192 x i8], [8192 x i8]* @syHistory, i64 0, i64 8189), %if.then1477 ], [ %incdec.ptr1730, %for.body1723 ]
664 %add.ptr1728 = getelementptr i8, i8* %q.303203, i64 %idx.neg1727
665 %5 = load i8, i8* %add.ptr1728, align 1, !tbaa !5
666 %incdec.ptr1730 = getelementptr i8, i8* %q.303203, i64 -1
667 br label %for.body1723
673 declare i32 @fileno(%struct.TMP.2* nocapture)
674 declare i64 @"\01_write"(i32, i8*, i64)
675 declare i32 @__maskrune(i32, i64)
676 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1)
680 !0 = !{!"clang version 3.5.0 (trunk 204257)"}
681 !1 = !{!2, !2, i64 0}
682 !2 = !{!"int", !3, i64 0}
683 !3 = !{!"omnipotent char", !4, i64 0}
684 !4 = !{!"Simple C/C++ TBAA"}
685 !5 = !{!3, !3, i64 0}
686 !6 = !{!7, !8, i64 8}
687 !7 = !{!"", !8, i64 0, !8, i64 8, !3, i64 16}
688 !8 = !{!"any pointer", !3, i64 0}