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 $536, %rsp ## imm = 0x218
33 ; CHECK-NEXT: .cfi_def_cfa_offset 592
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: movq %rdx, %rax
41 ; CHECK-NEXT: orq $2, %rax
42 ; CHECK-NEXT: cmpq $2, %rax
43 ; CHECK-NEXT: jne LBB0_4
44 ; CHECK-NEXT: ## %bb.1: ## %if.end
45 ; CHECK-NEXT: xorl %eax, %eax
46 ; CHECK-NEXT: testb %al, %al
47 ; CHECK-NEXT: jne LBB0_5
48 ; CHECK-NEXT: ## %bb.2: ## %if.then4
49 ; CHECK-NEXT: xorl %eax, %eax
50 ; CHECK-NEXT: testb %al, %al
51 ; CHECK-NEXT: je LBB0_55
52 ; CHECK-NEXT: ## %bb.3: ## %SyTime.exit
53 ; CHECK-NEXT: xorl %eax, %eax
54 ; CHECK-NEXT: testb %al, %al
55 ; CHECK-NEXT: je LBB0_55
56 ; CHECK-NEXT: LBB0_4: ## %cleanup
57 ; CHECK-NEXT: addq $536, %rsp ## imm = 0x218
58 ; CHECK-NEXT: popq %rbx
59 ; CHECK-NEXT: popq %r12
60 ; CHECK-NEXT: popq %r13
61 ; CHECK-NEXT: popq %r14
62 ; CHECK-NEXT: popq %r15
63 ; CHECK-NEXT: popq %rbp
65 ; CHECK-NEXT: LBB0_5: ## %if.end25
66 ; CHECK-NEXT: xorl %eax, %eax
67 ; CHECK-NEXT: testb %al, %al
68 ; CHECK-NEXT: je LBB0_55
69 ; CHECK-NEXT: ## %bb.6: ## %SyTime.exit2720
70 ; CHECK-NEXT: movq %rdx, %rbx
71 ; CHECK-NEXT: movq %rdi, %rbp
72 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rax
73 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
74 ; CHECK-NEXT: cmpq %rax, %rcx
75 ; CHECK-NEXT: jae LBB0_8
76 ; CHECK-NEXT: ## %bb.7: ## %for.body.lr.ph
77 ; CHECK-NEXT: movl $512, %edx ## imm = 0x200
78 ; CHECK-NEXT: movl $32, %esi
79 ; CHECK-NEXT: callq _memset
80 ; CHECK-NEXT: LBB0_8: ## %while.body.preheader
81 ; CHECK-NEXT: movq %rbp, {{[-0-9]+}}(%r{{[sb]}}p) ## 8-byte Spill
82 ; CHECK-NEXT: imulq $1040, %rbx, %rax ## imm = 0x410
83 ; CHECK-NEXT: movq _syBuf@{{.*}}(%rip), %rcx
84 ; CHECK-NEXT: leaq 8(%rcx,%rax), %rbx
85 ; CHECK-NEXT: movl $1, %r15d
86 ; CHECK-NEXT: movq _syCTRO@{{.*}}(%rip), %rax
87 ; CHECK-NEXT: movb $1, %cl
88 ; CHECK-NEXT: .p2align 4, 0x90
89 ; CHECK-NEXT: LBB0_9: ## %do.body
90 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
91 ; CHECK-NEXT: movl $0, (%rax)
92 ; CHECK-NEXT: testb %cl, %cl
93 ; CHECK-NEXT: jne LBB0_9
94 ; CHECK-NEXT: ## %bb.10: ## %do.end
95 ; CHECK-NEXT: xorl %r14d, %r14d
96 ; CHECK-NEXT: testb %r14b, %r14b
97 ; CHECK-NEXT: jne LBB0_11
98 ; CHECK-NEXT: ## %bb.12: ## %while.body200.preheader
99 ; CHECK-NEXT: xorl %edx, %edx
100 ; CHECK-NEXT: leaq {{.*}}(%rip), %rsi
101 ; CHECK-NEXT: leaq {{.*}}(%rip), %rdi
102 ; CHECK-NEXT: xorl %ebp, %ebp
103 ; CHECK-NEXT: xorl %r13d, %r13d
104 ; CHECK-NEXT: jmp LBB0_13
105 ; CHECK-NEXT: .p2align 4, 0x90
106 ; CHECK-NEXT: LBB0_20: ## %sw.bb256
107 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
108 ; CHECK-NEXT: movl %r14d, %r13d
109 ; CHECK-NEXT: LBB0_21: ## %while.cond197.backedge
110 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
111 ; CHECK-NEXT: decl %r15d
112 ; CHECK-NEXT: testl %r15d, %r15d
113 ; CHECK-NEXT: movl %r13d, %r14d
114 ; CHECK-NEXT: jle LBB0_22
115 ; CHECK-NEXT: LBB0_13: ## %while.body200
116 ; CHECK-NEXT: ## =>This Loop Header: Depth=1
117 ; CHECK-NEXT: ## Child Loop BB0_30 Depth 2
118 ; CHECK-NEXT: ## Child Loop BB0_38 Depth 2
119 ; CHECK-NEXT: leal -268(%r14), %eax
120 ; CHECK-NEXT: cmpl $105, %eax
121 ; CHECK-NEXT: ja LBB0_14
122 ; CHECK-NEXT: ## %bb.56: ## %while.body200
123 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
124 ; CHECK-NEXT: movslq (%rdi,%rax,4), %rax
125 ; CHECK-NEXT: addq %rdi, %rax
126 ; CHECK-NEXT: jmpq *%rax
127 ; CHECK-NEXT: LBB0_44: ## %while.cond1037.preheader
128 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
129 ; CHECK-NEXT: testb %dl, %dl
130 ; CHECK-NEXT: movl %r14d, %r13d
131 ; CHECK-NEXT: jne LBB0_21
132 ; CHECK-NEXT: jmp LBB0_55
133 ; CHECK-NEXT: .p2align 4, 0x90
134 ; CHECK-NEXT: LBB0_14: ## %while.body200
135 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
136 ; CHECK-NEXT: leal 1(%r14), %eax
137 ; CHECK-NEXT: cmpl $21, %eax
138 ; CHECK-NEXT: ja LBB0_20
139 ; CHECK-NEXT: ## %bb.15: ## %while.body200
140 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
141 ; CHECK-NEXT: movl $-1, %r13d
142 ; CHECK-NEXT: movslq (%rsi,%rax,4), %rax
143 ; CHECK-NEXT: addq %rsi, %rax
144 ; CHECK-NEXT: jmpq *%rax
145 ; CHECK-NEXT: LBB0_18: ## %while.cond201.preheader
146 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
147 ; CHECK-NEXT: movl $1, %r13d
148 ; CHECK-NEXT: jmp LBB0_21
149 ; CHECK-NEXT: LBB0_26: ## %sw.bb474
150 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
151 ; CHECK-NEXT: testb %dl, %dl
152 ; CHECK-NEXT: ## implicit-def: $r12
153 ; CHECK-NEXT: jne LBB0_34
154 ; CHECK-NEXT: ## %bb.27: ## %do.body479.preheader
155 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
156 ; CHECK-NEXT: testb %dl, %dl
157 ; CHECK-NEXT: ## implicit-def: $r12
158 ; CHECK-NEXT: jne LBB0_34
159 ; CHECK-NEXT: ## %bb.28: ## %land.rhs485.preheader
160 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
161 ; CHECK-NEXT: ## implicit-def: $rax
162 ; CHECK-NEXT: testb %al, %al
163 ; CHECK-NEXT: jns LBB0_30
164 ; CHECK-NEXT: jmp LBB0_55
165 ; CHECK-NEXT: .p2align 4, 0x90
166 ; CHECK-NEXT: LBB0_32: ## %do.body479.backedge
167 ; CHECK-NEXT: ## in Loop: Header=BB0_30 Depth=2
168 ; CHECK-NEXT: leaq 1(%r12), %rax
169 ; CHECK-NEXT: testb %dl, %dl
170 ; CHECK-NEXT: je LBB0_33
171 ; CHECK-NEXT: ## %bb.29: ## %land.rhs485
172 ; CHECK-NEXT: ## in Loop: Header=BB0_30 Depth=2
173 ; CHECK-NEXT: testb %al, %al
174 ; CHECK-NEXT: js LBB0_55
175 ; CHECK-NEXT: LBB0_30: ## %cond.true.i.i2780
176 ; CHECK-NEXT: ## Parent Loop BB0_13 Depth=1
177 ; CHECK-NEXT: ## => This Inner Loop Header: Depth=2
178 ; CHECK-NEXT: movq %rax, %r12
179 ; CHECK-NEXT: testb %dl, %dl
180 ; CHECK-NEXT: jne LBB0_32
181 ; CHECK-NEXT: ## %bb.31: ## %lor.rhs500
182 ; CHECK-NEXT: ## in Loop: Header=BB0_30 Depth=2
183 ; CHECK-NEXT: movl $256, %esi ## imm = 0x100
184 ; CHECK-NEXT: callq ___maskrune
185 ; CHECK-NEXT: xorl %edx, %edx
186 ; CHECK-NEXT: testb %dl, %dl
187 ; CHECK-NEXT: jne LBB0_32
188 ; CHECK-NEXT: jmp LBB0_34
189 ; CHECK-NEXT: LBB0_45: ## %sw.bb1134
190 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
191 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rax
192 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
193 ; CHECK-NEXT: cmpq %rax, %rcx
194 ; CHECK-NEXT: jb LBB0_55
195 ; CHECK-NEXT: ## %bb.46: ## in Loop: Header=BB0_13 Depth=1
196 ; CHECK-NEXT: xorl %ebp, %ebp
197 ; CHECK-NEXT: movl $268, %r13d ## imm = 0x10C
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, %r13d
202 ; CHECK-NEXT: jmp LBB0_21
203 ; CHECK-NEXT: LBB0_40: ## %sw.bb566
204 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
205 ; CHECK-NEXT: movl $20, %r13d
206 ; CHECK-NEXT: jmp LBB0_21
207 ; CHECK-NEXT: LBB0_33: ## %if.end517.loopexitsplit
208 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
209 ; CHECK-NEXT: incq %r12
210 ; CHECK-NEXT: LBB0_34: ## %if.end517
211 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
212 ; CHECK-NEXT: leal -324(%r13), %eax
213 ; CHECK-NEXT: cmpl $59, %eax
214 ; CHECK-NEXT: ja LBB0_35
215 ; CHECK-NEXT: ## %bb.57: ## %if.end517
216 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
217 ; CHECK-NEXT: movabsq $576460756598390785, %rcx ## imm = 0x800000100000001
218 ; CHECK-NEXT: btq %rax, %rcx
219 ; CHECK-NEXT: jb LBB0_38
220 ; CHECK-NEXT: LBB0_35: ## %if.end517
221 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
222 ; CHECK-NEXT: cmpl $11, %r13d
223 ; CHECK-NEXT: je LBB0_38
224 ; CHECK-NEXT: ## %bb.36: ## %if.end517
225 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
226 ; CHECK-NEXT: cmpl $24, %r13d
227 ; CHECK-NEXT: je LBB0_38
228 ; CHECK-NEXT: ## %bb.37: ## %if.then532
229 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
230 ; CHECK-NEXT: movq _SyFgets.yank@{{.*}}(%rip), %rax
231 ; CHECK-NEXT: movb $0, (%rax)
232 ; CHECK-NEXT: .p2align 4, 0x90
233 ; CHECK-NEXT: LBB0_38: ## %for.cond534
234 ; CHECK-NEXT: ## Parent Loop BB0_13 Depth=1
235 ; CHECK-NEXT: ## => This Inner Loop Header: Depth=2
236 ; CHECK-NEXT: testb %dl, %dl
237 ; CHECK-NEXT: jne LBB0_38
238 ; CHECK-NEXT: ## %bb.39: ## %for.cond542.preheader
239 ; CHECK-NEXT: ## in Loop: Header=BB0_13 Depth=1
240 ; CHECK-NEXT: testb %dl, %dl
241 ; CHECK-NEXT: movb $0, (%r12)
242 ; CHECK-NEXT: movl %r14d, %r13d
243 ; CHECK-NEXT: leaq {{.*}}(%rip), %rsi
244 ; CHECK-NEXT: leaq {{.*}}(%rip), %rdi
245 ; CHECK-NEXT: jmp LBB0_21
246 ; CHECK-NEXT: .p2align 4, 0x90
247 ; CHECK-NEXT: LBB0_42: ## %while.cond864
248 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
249 ; CHECK-NEXT: jmp LBB0_42
250 ; CHECK-NEXT: .p2align 4, 0x90
251 ; CHECK-NEXT: LBB0_43: ## %while.cond962
252 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
253 ; CHECK-NEXT: jmp LBB0_43
254 ; CHECK-NEXT: .p2align 4, 0x90
255 ; CHECK-NEXT: LBB0_25: ## %for.cond357
256 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
257 ; CHECK-NEXT: jmp LBB0_25
258 ; CHECK-NEXT: LBB0_11:
259 ; CHECK-NEXT: xorl %ebp, %ebp
260 ; CHECK-NEXT: xorl %r13d, %r13d
261 ; CHECK-NEXT: LBB0_22: ## %while.end1465
262 ; CHECK-NEXT: incl %r13d
263 ; CHECK-NEXT: cmpl $16, %r13d
264 ; CHECK-NEXT: ja LBB0_50
265 ; CHECK-NEXT: ## %bb.23: ## %while.end1465
266 ; CHECK-NEXT: movl $83969, %eax ## imm = 0x14801
267 ; CHECK-NEXT: btl %r13d, %eax
268 ; CHECK-NEXT: jae LBB0_50
269 ; CHECK-NEXT: ## %bb.24:
270 ; CHECK-NEXT: xorl %ebp, %ebp
271 ; CHECK-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx ## 8-byte Reload
272 ; CHECK-NEXT: LBB0_48: ## %if.then1477
273 ; CHECK-NEXT: movl $1, %edx
274 ; CHECK-NEXT: callq _write
275 ; CHECK-NEXT: subq %rbp, %rbx
276 ; CHECK-NEXT: movq _syHistory@{{.*}}(%rip), %rax
277 ; CHECK-NEXT: leaq 8189(%rbx,%rax), %rax
278 ; CHECK-NEXT: .p2align 4, 0x90
279 ; CHECK-NEXT: LBB0_49: ## %for.body1723
280 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
281 ; CHECK-NEXT: decq %rax
282 ; CHECK-NEXT: jmp LBB0_49
283 ; CHECK-NEXT: LBB0_50: ## %for.cond1480.preheader
284 ; CHECK-NEXT: movl $512, %eax ## imm = 0x200
285 ; CHECK-NEXT: cmpq %rax, %rax
286 ; CHECK-NEXT: jae LBB0_55
287 ; CHECK-NEXT: ## %bb.51: ## %for.body1664.lr.ph
288 ; CHECK-NEXT: xorl %eax, %eax
289 ; CHECK-NEXT: testb %al, %al
290 ; CHECK-NEXT: jne LBB0_54
291 ; CHECK-NEXT: ## %bb.52: ## %while.body1679.preheader
292 ; CHECK-NEXT: incl %ebp
293 ; CHECK-NEXT: .p2align 4, 0x90
294 ; CHECK-NEXT: LBB0_53: ## %while.body1679
295 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
296 ; CHECK-NEXT: movq (%rbx), %rdi
297 ; CHECK-NEXT: callq _fileno
298 ; CHECK-NEXT: movslq %ebp, %rax
299 ; CHECK-NEXT: leal 1(%rax), %ebp
300 ; CHECK-NEXT: cmpq %rax, %rax
301 ; CHECK-NEXT: jl LBB0_53
302 ; CHECK-NEXT: LBB0_54: ## %while.cond1683.preheader
303 ; CHECK-NEXT: xorl %eax, %eax
304 ; CHECK-NEXT: testb %al, %al
305 ; CHECK-NEXT: LBB0_55: ## %if.then.i
307 ; CHECK-NEXT: LBB0_47: ## %if.then1477.loopexit
308 ; CHECK-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx ## 8-byte Reload
309 ; CHECK-NEXT: movq %rbx, %rbp
310 ; CHECK-NEXT: jmp LBB0_48
311 ; CHECK-NEXT: LBB0_16: ## %while.cond635.preheader
312 ; CHECK-NEXT: xorl %eax, %eax
313 ; CHECK-NEXT: testb %al, %al
314 ; CHECK-NEXT: je LBB0_41
315 ; CHECK-NEXT: .p2align 4, 0x90
316 ; CHECK-NEXT: LBB0_17: ## %for.body643.us
317 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
318 ; CHECK-NEXT: jmp LBB0_17
319 ; CHECK-NEXT: .p2align 4, 0x90
320 ; CHECK-NEXT: LBB0_41: ## %while.cond661
321 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
322 ; CHECK-NEXT: jmp LBB0_41
324 %sub.ptr.rhs.cast646 = ptrtoint i8* %line to i64
325 %old = alloca [512 x i8], align 16
326 %0 = getelementptr inbounds [512 x i8], [512 x i8]* %old, i64 0, i64 0
327 switch i64 %fid, label %if.then [
336 switch i64 undef, label %if.end25 [
337 i64 0, label %if.then4
338 i64 1, label %if.end25
342 br i1 undef, label %SyTime.exit, label %if.then.i
348 br i1 undef, label %SyTime.exit2681, label %if.then.i2673
360 br i1 undef, label %SyTime.exit2720, label %if.then.i2712
366 %add.ptr = getelementptr [512 x i8], [512 x i8]* %old, i64 0, i64 512
367 %cmp293427 = icmp ult i8* %0, %add.ptr
368 br i1 %cmp293427, label %for.body.lr.ph, label %while.body.preheader
371 call void @llvm.memset.p0i8.i64(i8* align 16 undef, i8 32, i64 512, i1 false)
372 br label %while.body.preheader
374 while.body.preheader:
375 %add.ptr1603 = getelementptr [512 x i8], [512 x i8]* null, i64 0, i64 512
376 %echo.i3101 = getelementptr [16 x %struct.TMP.1], [16 x %struct.TMP.1]* @syBuf, i64 0, i64 %fid, i32 1
377 %1 = xor i64 %sub.ptr.rhs.cast646, -1
381 %ch2.0 = phi i32 [ 0, %while.body.preheader ], [ %ch.12.ch2.12, %do.body ]
382 %rep.0 = phi i32 [ 1, %while.body.preheader ], [ %rep.6, %do.body ]
383 store i32 0, i32* @syCTRO, align 4, !tbaa !1
384 %ch.0.ch2.0 = select i1 undef, i32 14, i32 %ch2.0
385 %ch2.2 = select i1 undef, i32 0, i32 %ch.0.ch2.0
386 %ch.2.ch2.2 = select i1 undef, i32 0, i32 %ch2.2
387 %ch2.4 = select i1 undef, i32 278, i32 %ch.2.ch2.2
388 %ch2.5 = select i1 undef, i32 0, i32 %ch2.4
389 %rep.2 = select i1 undef, i32 undef, i32 %rep.0
390 %ch.5.ch2.5 = select i1 undef, i32 undef, i32 %ch2.5
391 %ch2.7 = select i1 undef, i32 0, i32 %ch.5.ch2.5
392 %rep.3 = select i1 undef, i32 undef, i32 %rep.2
393 %ch.7.ch2.7 = select i1 false, i32 0, i32 %ch2.7
394 %mul98.rep.3 = select i1 false, i32 0, i32 %rep.3
395 %ch2.9 = select i1 undef, i32 undef, i32 %ch.7.ch2.7
396 %rep.5 = select i1 undef, i32 undef, i32 %mul98.rep.3
397 %ch2.10 = select i1 false, i32 undef, i32 %ch2.9
398 %rep.6 = select i1 false, i32 undef, i32 %rep.5
399 %isdigittmp = add i32 %ch2.10, -48
400 %isdigit = icmp ult i32 %isdigittmp, 10
401 %cmp119 = icmp eq i32 undef, 22
402 %or.cond1875 = and i1 %isdigit, %cmp119
403 %ch.10.ch2.10 = select i1 %or.cond1875, i32 undef, i32 %ch2.10
404 %.ch.10 = select i1 %or.cond1875, i32 0, i32 undef
405 %ch2.12 = select i1 undef, i32 %.ch.10, i32 %ch.10.ch2.10
406 %ch.12 = select i1 undef, i32 0, i32 %.ch.10
407 %ch.12.ch2.12 = select i1 false, i32 %ch.12, i32 %ch2.12
408 %.ch.12 = select i1 false, i32 0, i32 %ch.12
409 %cmp147 = icmp eq i32 %.ch.12, 0
410 br i1 %cmp147, label %do.body, label %do.end
413 %cmp164 = icmp eq i32 %ch.12.ch2.12, 21
414 %mul167 = shl i32 %rep.6, 2
415 %rep.8 = select i1 %cmp164, i32 %mul167, i32 %rep.6
416 %..ch.19 = select i1 false, i32 2, i32 0
417 br i1 undef, label %while.body200, label %while.end1465
420 %dec3386.in = phi i32 [ %dec3386, %while.cond197.backedge ], [ %rep.8, %do.end ]
421 %oldc.13384 = phi i32 [ %oldc.1.be, %while.cond197.backedge ], [ 0, %do.end ]
422 %ch.213379 = phi i32 [ %last.1.be, %while.cond197.backedge ], [ %..ch.19, %do.end ]
423 %last.13371 = phi i32 [ %last.1.be, %while.cond197.backedge ], [ 0, %do.end ]
424 %dec3386 = add i32 %dec3386.in, -1
425 switch i32 %ch.213379, label %sw.default [
426 i32 1, label %while.cond201.preheader
427 i32 322, label %sw.bb206
428 i32 354, label %sw.bb206
429 i32 2, label %sw.bb243
430 i32 364, label %sw.bb1077
431 i32 326, label %sw.bb256
432 i32 358, label %sw.bb256
433 i32 341, label %sw.bb979
434 i32 323, label %while.cond1037.preheader
435 i32 373, label %sw.bb979
436 i32 4, label %if.then1477
437 i32 332, label %sw.bb1077
438 i32 11, label %for.cond357
439 i32 355, label %while.cond1037.preheader
440 i32 324, label %sw.bb474
441 i32 356, label %sw.bb474
442 i32 20, label %sw.bb566
443 i32 -1, label %while.cond197.backedge
444 i32 268, label %sw.bb1134
445 i32 16, label %while.cond635.preheader
446 i32 18, label %sw.bb956
447 i32 316, label %while.cond864
450 while.cond1037.preheader:
451 %cmp10393273 = icmp eq i8 undef, 0
452 br i1 %cmp10393273, label %if.end1070, label %land.rhs1041
454 while.cond635.preheader:
455 br i1 undef, label %for.body643.us, label %while.cond661
458 br label %for.body643.us
460 while.cond201.preheader:
461 %umax = select i1 false, i64 undef, i64 %1
462 %2 = xor i64 %umax, -1
463 %3 = inttoptr i64 %2 to i8*
464 br label %while.cond197.backedge
467 br label %while.cond197.backedge
470 br label %while.cond197.backedge
473 br label %while.cond197.backedge
475 while.cond197.backedge:
476 %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 ]
477 %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 ]
478 %cmp198 = icmp sgt i32 %dec3386, 0
479 br i1 %cmp198, label %while.body200, label %while.end1465
482 br label %for.cond357
485 ; spill is hoisted here. Although loop depth1 is even hotter than loop depth2, sw.bb474 is still cold.
486 %cmp476 = icmp eq i8 undef, 0
487 br i1 %cmp476, label %if.end517, label %do.body479.preheader
489 do.body479.preheader:
490 %cmp4833314 = icmp eq i8 undef, 0
491 br i1 %cmp4833314, label %if.end517, label %land.rhs485
494 %incdec.ptr4803316 = phi i8* [ %incdec.ptr480, %do.body479.backedge.land.rhs485_crit_edge ], [ undef, %do.body479.preheader ]
495 %isascii.i.i27763151 = icmp sgt i8 undef, -1
496 br i1 %isascii.i.i27763151, label %cond.true.i.i2780, label %cond.false.i.i2782
499 br i1 undef, label %land.lhs.true490, label %lor.rhs500
505 br i1 false, label %lor.rhs500, label %do.body479.backedge
508 ; Make sure spill is hoisted to a cold preheader in outside loop.
509 %call3.i.i2792 = call i32 @__maskrune(i32 undef, i64 256)
510 br i1 undef, label %land.lhs.true504, label %do.body479.backedge
513 br i1 undef, label %do.body479.backedge, label %if.end517
516 %incdec.ptr480 = getelementptr i8, i8* %incdec.ptr4803316, i64 1
517 %cmp483 = icmp eq i8 undef, 0
518 br i1 %cmp483, label %if.end517, label %do.body479.backedge.land.rhs485_crit_edge
520 do.body479.backedge.land.rhs485_crit_edge:
521 br label %land.rhs485
524 %q.4 = phi i8* [ undef, %sw.bb474 ], [ undef, %do.body479.preheader ], [ %incdec.ptr480, %do.body479.backedge ], [ %incdec.ptr4803316, %land.lhs.true504 ]
525 switch i32 %last.13371, label %if.then532 [
526 i32 383, label %for.cond534
527 i32 356, label %for.cond534
528 i32 324, label %for.cond534
529 i32 24, label %for.cond534
530 i32 11, label %for.cond534
534 store i8 0, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @SyFgets.yank, i64 0, i64 0), align 16, !tbaa !5
535 br label %for.cond534
538 %cmp536 = icmp eq i8 undef, 0
539 br i1 %cmp536, label %for.cond542.preheader, label %for.cond534
541 for.cond542.preheader:
542 br i1 undef, label %for.body545, label %for.end552
545 br i1 undef, label %for.end552, label %for.body545
548 %s.2.lcssa = phi i8* [ undef, %for.cond542.preheader ], [ %q.4, %for.body545 ]
549 %sub.ptr.lhs.cast553 = ptrtoint i8* %s.2.lcssa to i64
550 %sub.ptr.sub555 = sub i64 %sub.ptr.lhs.cast553, 0
551 %arrayidx556 = getelementptr i8, i8* null, i64 %sub.ptr.sub555
552 store i8 0, i8* %arrayidx556, align 1, !tbaa !5
553 br label %while.cond197.backedge
556 br label %while.cond197.backedge
559 br label %while.cond661
562 br label %while.cond864
565 br i1 undef, label %if.then959, label %while.cond197.backedge
568 br label %while.cond962
571 br label %while.cond962
574 br label %while.cond197.backedge
583 br label %while.cond197.backedge
586 br i1 false, label %for.body1139, label %for.cond1145.preheader
588 for.cond1145.preheader:
589 br i1 %cmp293427, label %for.body1150.lr.ph, label %while.cond197.backedge
598 br label %while.cond197.backedge
601 %oldc.1.lcssa = phi i32 [ 0, %do.end ], [ %oldc.1.be, %while.cond197.backedge ]
602 %ch.21.lcssa = phi i32 [ %..ch.19, %do.end ], [ %last.1.be, %while.cond197.backedge ]
603 switch i32 %ch.21.lcssa, label %for.cond1480.preheader [
604 i32 -1, label %if.then1477
605 i32 15, label %if.then1477
606 i32 13, label %if.then1477
607 i32 10, label %if.then1477
610 for.cond1480.preheader:
611 br i1 undef, label %for.body1606.lr.ph, label %for.end1609
614 %p.1.lcssa3539 = phi i8* [ null, %while.end1465 ], [ null, %while.end1465 ], [ null, %while.end1465 ], [ null, %while.end1465 ], [ %line, %while.body200 ]
615 %call1.i3057 = call i64 @"\01_write"(i32 undef, i8* undef, i64 1)
616 %sub.ptr.lhs.cast1717 = ptrtoint i8* %p.1.lcssa3539 to i64
617 %sub.ptr.sub1719 = sub i64 %sub.ptr.lhs.cast1717, %sub.ptr.rhs.cast646
618 %idx.neg1727 = sub i64 0, %sub.ptr.sub1719
619 br label %for.body1723
622 br label %for.end1609
625 br i1 undef, label %for.cond1659.preheader, label %land.lhs.true1614
628 br label %for.cond1659.preheader
630 for.cond1659.preheader:
631 %cmp16623414 = icmp ult i8* undef, %add.ptr1603
632 br i1 %cmp16623414, label %for.body1664.lr.ph, label %while.body1703.lr.ph
635 %cmp16773405 = icmp slt i64 undef, undef
636 br i1 %cmp16773405, label %while.body1679, label %while.cond1683.preheader
638 while.body1703.lr.ph:
641 while.cond1683.preheader:
642 br i1 undef, label %while.body1691, label %while.end1693
645 %oldc.43406 = phi i32 [ %inc, %syEchoch.exit3070 ], [ %oldc.1.lcssa, %for.body1664.lr.ph ]
646 %4 = load %struct.TMP.2*, %struct.TMP.2** %echo.i3101, align 8, !tbaa !6
647 %call.i3062 = call i32 @fileno(%struct.TMP.2* %4)
648 br i1 undef, label %if.then.i3069, label %syEchoch.exit3070
651 br label %syEchoch.exit3070
654 %inc = add i32 %oldc.43406, 1
655 %conv1672 = sext i32 %inc to i64
656 %cmp1677 = icmp slt i64 %conv1672, undef
657 br i1 %cmp1677, label %while.body1679, label %while.cond1683.preheader
666 %q.303203 = phi i8* [ getelementptr inbounds ([8192 x i8], [8192 x i8]* @syHistory, i64 0, i64 8189), %if.then1477 ], [ %incdec.ptr1730, %for.body1723 ]
667 %add.ptr1728 = getelementptr i8, i8* %q.303203, i64 %idx.neg1727
668 %5 = load i8, i8* %add.ptr1728, align 1, !tbaa !5
669 %incdec.ptr1730 = getelementptr i8, i8* %q.303203, i64 -1
670 br label %for.body1723
676 declare i32 @fileno(%struct.TMP.2* nocapture)
677 declare i64 @"\01_write"(i32, i8*, i64)
678 declare i32 @__maskrune(i32, i64)
679 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1)
683 !0 = !{!"clang version 3.5.0 (trunk 204257)"}
684 !1 = !{!2, !2, i64 0}
685 !2 = !{!"int", !3, i64 0}
686 !3 = !{!"omnipotent char", !4, i64 0}
687 !4 = !{!"Simple C/C++ TBAA"}
688 !5 = !{!3, !3, i64 0}
689 !6 = !{!7, !8, i64 8}
690 !7 = !{!"", !8, i64 0, !8, i64 8, !3, i64 16}
691 !8 = !{!"any pointer", !3, i64 0}