~pali/+junk/llvm-toolchain-3.7

« back to all changes in this revision

Viewing changes to test/CodeGen/X86/ragreedy-hoist-spill.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2015-07-15 17:51:08 UTC
  • Revision ID: package-import@ubuntu.com-20150715175108-l8mynwovkx4zx697
Tags: upstream-3.7~+rc2
ImportĀ upstreamĀ versionĀ 3.7~+rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; RUN: llc < %s -mtriple=x86_64-apple-macosx -regalloc=greedy | FileCheck %s
 
2
 
 
3
; This testing case is reduced from 254.gap SyFgets funciton.
 
4
; We make sure a spill is not hoisted to a hotter outer loop.
 
5
 
 
6
%struct.TMP.1 = type { %struct.TMP.2*, %struct.TMP.2*, [1024 x i8] }
 
7
%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 }
 
8
%struct.TMP.4 = type opaque
 
9
%struct.TMP.3 = type { i8*, i32 }
 
10
 
 
11
@syBuf = external global [16 x %struct.TMP.1], align 16
 
12
@syHistory = external global [8192 x i8], align 16
 
13
@SyFgets.yank = external global [512 x i8], align 16
 
14
@syCTRO = external global i32, align 4
 
15
 
 
16
; CHECK-LABEL: SyFgets
 
17
define i8* @SyFgets(i8* %line, i64 %length, i64 %fid) {
 
18
entry:
 
19
  %sub.ptr.rhs.cast646 = ptrtoint i8* %line to i64
 
20
  %old = alloca [512 x i8], align 16
 
21
  %0 = getelementptr inbounds [512 x i8], [512 x i8]* %old, i64 0, i64 0
 
22
  switch i64 %fid, label %if.then [
 
23
    i64 2, label %if.end
 
24
    i64 0, label %if.end
 
25
  ]
 
26
 
 
27
if.then:
 
28
  br label %cleanup
 
29
 
 
30
if.end:
 
31
  switch i64 undef, label %if.end25 [
 
32
    i64 0, label %if.then4
 
33
    i64 1, label %if.end25
 
34
  ]
 
35
 
 
36
if.then4:
 
37
  br i1 undef, label %SyTime.exit, label %if.then.i
 
38
 
 
39
if.then.i:
 
40
  unreachable
 
41
 
 
42
SyTime.exit:
 
43
  br i1 undef, label %SyTime.exit2681, label %if.then.i2673
 
44
 
 
45
if.then.i2673:
 
46
  unreachable
 
47
 
 
48
SyTime.exit2681:
 
49
  br label %cleanup
 
50
 
 
51
land.lhs.true14:
 
52
  unreachable
 
53
 
 
54
if.end25:
 
55
  br i1 undef, label %SyTime.exit2720, label %if.then.i2712
 
56
 
 
57
if.then.i2712:
 
58
  unreachable
 
59
 
 
60
SyTime.exit2720:
 
61
  %add.ptr = getelementptr [512 x i8], [512 x i8]* %old, i64 0, i64 512
 
62
  %cmp293427 = icmp ult i8* %0, %add.ptr
 
63
  br i1 %cmp293427, label %for.body.lr.ph, label %while.body.preheader
 
64
 
 
65
for.body.lr.ph:
 
66
  call void @llvm.memset.p0i8.i64(i8* undef, i8 32, i64 512, i32 16, i1 false)
 
67
  br label %while.body.preheader
 
68
 
 
69
while.body.preheader:
 
70
  %add.ptr1603 = getelementptr [512 x i8], [512 x i8]* null, i64 0, i64 512
 
71
  %echo.i3101 = getelementptr [16 x %struct.TMP.1], [16 x %struct.TMP.1]* @syBuf, i64 0, i64 %fid, i32 1
 
72
  %1 = xor i64 %sub.ptr.rhs.cast646, -1
 
73
  br label %do.body
 
74
 
 
75
do.body:
 
76
  %ch2.0 = phi i32 [ 0, %while.body.preheader ], [ %ch.12.ch2.12, %do.body ]
 
77
  %rep.0 = phi i32 [ 1, %while.body.preheader ], [ %rep.6, %do.body ]
 
78
  store i32 0, i32* @syCTRO, align 4, !tbaa !1
 
79
  %ch.0.ch2.0 = select i1 undef, i32 14, i32 %ch2.0
 
80
  %ch2.2 = select i1 undef, i32 0, i32 %ch.0.ch2.0
 
81
  %ch.2.ch2.2 = select i1 undef, i32 0, i32 %ch2.2
 
82
  %ch2.4 = select i1 undef, i32 278, i32 %ch.2.ch2.2
 
83
  %ch2.5 = select i1 undef, i32 0, i32 %ch2.4
 
84
  %rep.2 = select i1 undef, i32 undef, i32 %rep.0
 
85
  %ch.5.ch2.5 = select i1 undef, i32 undef, i32 %ch2.5
 
86
  %ch2.7 = select i1 undef, i32 0, i32 %ch.5.ch2.5
 
87
  %rep.3 = select i1 undef, i32 undef, i32 %rep.2
 
88
  %ch.7.ch2.7 = select i1 false, i32 0, i32 %ch2.7
 
89
  %mul98.rep.3 = select i1 false, i32 0, i32 %rep.3
 
90
  %ch2.9 = select i1 undef, i32 undef, i32 %ch.7.ch2.7
 
91
  %rep.5 = select i1 undef, i32 undef, i32 %mul98.rep.3
 
92
  %ch2.10 = select i1 false, i32 undef, i32 %ch2.9
 
93
  %rep.6 = select i1 false, i32 undef, i32 %rep.5
 
94
  %isdigittmp = add i32 %ch2.10, -48
 
95
  %isdigit = icmp ult i32 %isdigittmp, 10
 
96
  %cmp119 = icmp eq i32 undef, 22
 
97
  %or.cond1875 = and i1 %isdigit, %cmp119
 
98
  %ch.10.ch2.10 = select i1 %or.cond1875, i32 undef, i32 %ch2.10
 
99
  %.ch.10 = select i1 %or.cond1875, i32 0, i32 undef
 
100
  %ch2.12 = select i1 undef, i32 %.ch.10, i32 %ch.10.ch2.10
 
101
  %ch.12 = select i1 undef, i32 0, i32 %.ch.10
 
102
  %ch.12.ch2.12 = select i1 false, i32 %ch.12, i32 %ch2.12
 
103
  %.ch.12 = select i1 false, i32 0, i32 %ch.12
 
104
  %cmp147 = icmp eq i32 %.ch.12, 0
 
105
  br i1 %cmp147, label %do.body, label %do.end
 
106
 
 
107
do.end:
 
108
  %cmp164 = icmp eq i32 %ch.12.ch2.12, 21
 
109
  %mul167 = shl i32 %rep.6, 2
 
110
  %rep.8 = select i1 %cmp164, i32 %mul167, i32 %rep.6
 
111
  %..ch.19 = select i1 false, i32 2, i32 0
 
112
  br i1 undef, label %while.body200, label %while.end1465
 
113
 
 
114
while.body200:
 
115
  %dec3386.in = phi i32 [ %dec3386, %while.cond197.backedge ], [ %rep.8, %do.end ]
 
116
  %oldc.13384 = phi i32 [ %oldc.1.be, %while.cond197.backedge ], [ 0, %do.end ]
 
117
  %ch.213379 = phi i32 [ %last.1.be, %while.cond197.backedge ], [ %..ch.19, %do.end ]
 
118
  %last.13371 = phi i32 [ %last.1.be, %while.cond197.backedge ], [ 0, %do.end ]
 
119
  %dec3386 = add i32 %dec3386.in, -1
 
120
  switch i32 %ch.213379, label %sw.default [
 
121
    i32 1, label %while.cond201.preheader
 
122
    i32 322, label %sw.bb206
 
123
    i32 354, label %sw.bb206
 
124
    i32 2, label %sw.bb243
 
125
    i32 364, label %sw.bb1077
 
126
    i32 326, label %sw.bb256
 
127
    i32 358, label %sw.bb256
 
128
    i32 341, label %sw.bb979
 
129
    i32 323, label %while.cond1037.preheader
 
130
    i32 373, label %sw.bb979
 
131
    i32 4, label %if.then1477
 
132
    i32 332, label %sw.bb1077
 
133
    i32 11, label %for.cond357
 
134
    i32 355, label %while.cond1037.preheader
 
135
    i32 324, label %sw.bb474
 
136
    i32 356, label %sw.bb474
 
137
    i32 20, label %sw.bb566
 
138
    i32 -1, label %while.cond197.backedge
 
139
    i32 268, label %sw.bb1134
 
140
    i32 16, label %while.cond635.preheader
 
141
    i32 18, label %sw.bb956
 
142
    i32 316, label %while.cond864
 
143
  ]
 
144
 
 
145
while.cond1037.preheader:
 
146
  %cmp10393273 = icmp eq i8 undef, 0
 
147
  br i1 %cmp10393273, label %if.end1070, label %land.rhs1041
 
148
 
 
149
while.cond635.preheader:
 
150
  br i1 undef, label %for.body643.us, label %while.cond661
 
151
 
 
152
for.body643.us:
 
153
  br label %for.body643.us
 
154
 
 
155
while.cond201.preheader:
 
156
  %umax = select i1 false, i64 undef, i64 %1
 
157
  %2 = xor i64 %umax, -1
 
158
  %3 = inttoptr i64 %2 to i8*
 
159
  br label %while.cond197.backedge
 
160
 
 
161
sw.bb206:
 
162
  br label %while.cond197.backedge
 
163
 
 
164
sw.bb243:
 
165
  br label %while.cond197.backedge
 
166
 
 
167
sw.bb256:
 
168
  br label %while.cond197.backedge
 
169
 
 
170
while.cond197.backedge:
 
171
  %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 ]
 
172
  %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 ]
 
173
  %cmp198 = icmp sgt i32 %dec3386, 0
 
174
  br i1 %cmp198, label %while.body200, label %while.end1465
 
175
 
 
176
for.cond357:
 
177
  br label %for.cond357
 
178
 
 
179
sw.bb474:
 
180
  %cmp476 = icmp eq i8 undef, 0
 
181
  br i1 %cmp476, label %if.end517, label %do.body479.preheader
 
182
 
 
183
do.body479.preheader:
 
184
  %cmp4833314 = icmp eq i8 undef, 0
 
185
  br i1 %cmp4833314, label %if.end517, label %land.rhs485
 
186
 
 
187
land.rhs485:
 
188
  %incdec.ptr4803316 = phi i8* [ %incdec.ptr480, %do.body479.backedge.land.rhs485_crit_edge ], [ undef, %do.body479.preheader ]
 
189
  %isascii.i.i27763151 = icmp sgt i8 undef, -1
 
190
  br i1 %isascii.i.i27763151, label %cond.true.i.i2780, label %cond.false.i.i2782
 
191
 
 
192
cond.true.i.i2780:
 
193
  br i1 undef, label %land.lhs.true490, label %lor.rhs500
 
194
 
 
195
cond.false.i.i2782:
 
196
  unreachable
 
197
 
 
198
land.lhs.true490:
 
199
  br i1 false, label %lor.rhs500, label %do.body479.backedge
 
200
 
 
201
lor.rhs500:
 
202
  ; CHECK: lor.rhs500
 
203
  ; Make sure that we don't hoist the spill to outer loops.
 
204
  ; CHECK: movq %r{{.*}}, {{[0-9]+}}(%rsp)
 
205
  ; CHECK: callq {{.*}}maskrune
 
206
  %call3.i.i2792 = call i32 @__maskrune(i32 undef, i64 256)
 
207
  br i1 undef, label %land.lhs.true504, label %do.body479.backedge
 
208
 
 
209
land.lhs.true504:
 
210
  br i1 undef, label %do.body479.backedge, label %if.end517
 
211
 
 
212
do.body479.backedge:
 
213
  %incdec.ptr480 = getelementptr i8, i8* %incdec.ptr4803316, i64 1
 
214
  %cmp483 = icmp eq i8 undef, 0
 
215
  br i1 %cmp483, label %if.end517, label %do.body479.backedge.land.rhs485_crit_edge
 
216
 
 
217
do.body479.backedge.land.rhs485_crit_edge:
 
218
  br label %land.rhs485
 
219
 
 
220
if.end517:
 
221
  %q.4 = phi i8* [ undef, %sw.bb474 ], [ undef, %do.body479.preheader ], [ %incdec.ptr480, %do.body479.backedge ], [ %incdec.ptr4803316, %land.lhs.true504 ]
 
222
  switch i32 %last.13371, label %if.then532 [
 
223
    i32 383, label %for.cond534
 
224
    i32 356, label %for.cond534
 
225
    i32 324, label %for.cond534
 
226
    i32 24, label %for.cond534
 
227
    i32 11, label %for.cond534
 
228
  ]
 
229
 
 
230
if.then532:
 
231
  store i8 0, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @SyFgets.yank, i64 0, i64 0), align 16, !tbaa !5
 
232
  br label %for.cond534
 
233
 
 
234
for.cond534:
 
235
  %cmp536 = icmp eq i8 undef, 0
 
236
  br i1 %cmp536, label %for.cond542.preheader, label %for.cond534
 
237
 
 
238
for.cond542.preheader:
 
239
  br i1 undef, label %for.body545, label %for.end552
 
240
 
 
241
for.body545:
 
242
  br i1 undef, label %for.end552, label %for.body545
 
243
 
 
244
for.end552:
 
245
  %s.2.lcssa = phi i8* [ undef, %for.cond542.preheader ], [ %q.4, %for.body545 ]
 
246
  %sub.ptr.lhs.cast553 = ptrtoint i8* %s.2.lcssa to i64
 
247
  %sub.ptr.sub555 = sub i64 %sub.ptr.lhs.cast553, 0
 
248
  %arrayidx556 = getelementptr i8, i8* null, i64 %sub.ptr.sub555
 
249
  store i8 0, i8* %arrayidx556, align 1, !tbaa !5
 
250
  br label %while.cond197.backedge
 
251
 
 
252
sw.bb566:
 
253
  br label %while.cond197.backedge
 
254
 
 
255
while.cond661:
 
256
  br label %while.cond661
 
257
 
 
258
while.cond864:
 
259
  br label %while.cond864
 
260
 
 
261
sw.bb956:
 
262
  br i1 undef, label %if.then959, label %while.cond197.backedge
 
263
 
 
264
if.then959:
 
265
  br label %while.cond962
 
266
 
 
267
while.cond962:
 
268
  br label %while.cond962
 
269
 
 
270
sw.bb979:
 
271
  br label %while.cond197.backedge
 
272
 
 
273
land.rhs1041:
 
274
  unreachable
 
275
 
 
276
if.end1070:
 
277
  br label %sw.bb1077
 
278
 
 
279
sw.bb1077:
 
280
  br label %while.cond197.backedge
 
281
 
 
282
sw.bb1134:
 
283
  br i1 false, label %for.body1139, label %for.cond1145.preheader
 
284
 
 
285
for.cond1145.preheader:
 
286
  br i1 %cmp293427, label %for.body1150.lr.ph, label %while.cond197.backedge
 
287
 
 
288
for.body1150.lr.ph:
 
289
  unreachable
 
290
 
 
291
for.body1139:
 
292
  unreachable
 
293
 
 
294
sw.default:
 
295
  br label %while.cond197.backedge
 
296
 
 
297
while.end1465:
 
298
  %oldc.1.lcssa = phi i32 [ 0, %do.end ], [ %oldc.1.be, %while.cond197.backedge ]
 
299
  %ch.21.lcssa = phi i32 [ %..ch.19, %do.end ], [ %last.1.be, %while.cond197.backedge ]
 
300
  switch i32 %ch.21.lcssa, label %for.cond1480.preheader [
 
301
    i32 -1, label %if.then1477
 
302
    i32 15, label %if.then1477
 
303
    i32 13, label %if.then1477
 
304
    i32 10, label %if.then1477
 
305
  ]
 
306
 
 
307
for.cond1480.preheader:
 
308
  br i1 undef, label %for.body1606.lr.ph, label %for.end1609
 
309
 
 
310
if.then1477:
 
311
  %p.1.lcssa3539 = phi i8* [ null, %while.end1465 ], [ null, %while.end1465 ], [ null, %while.end1465 ], [ null, %while.end1465 ], [ %line, %while.body200 ]
 
312
  %call1.i3057 = call i64 @"\01_write"(i32 undef, i8* undef, i64 1)
 
313
  %sub.ptr.lhs.cast1717 = ptrtoint i8* %p.1.lcssa3539 to i64
 
314
  %sub.ptr.sub1719 = sub i64 %sub.ptr.lhs.cast1717, %sub.ptr.rhs.cast646
 
315
  %idx.neg1727 = sub i64 0, %sub.ptr.sub1719
 
316
  br label %for.body1723
 
317
 
 
318
for.body1606.lr.ph:
 
319
  br label %for.end1609
 
320
 
 
321
for.end1609:
 
322
  br i1 undef, label %for.cond1659.preheader, label %land.lhs.true1614
 
323
 
 
324
land.lhs.true1614:
 
325
  br label %for.cond1659.preheader
 
326
 
 
327
for.cond1659.preheader:
 
328
  %cmp16623414 = icmp ult i8* undef, %add.ptr1603
 
329
  br i1 %cmp16623414, label %for.body1664.lr.ph, label %while.body1703.lr.ph
 
330
 
 
331
for.body1664.lr.ph:
 
332
  %cmp16773405 = icmp slt i64 undef, undef
 
333
  br i1 %cmp16773405, label %while.body1679, label %while.cond1683.preheader
 
334
 
 
335
while.body1703.lr.ph:
 
336
  unreachable
 
337
 
 
338
while.cond1683.preheader:
 
339
  br i1 undef, label %while.body1691, label %while.end1693
 
340
 
 
341
while.body1679:
 
342
  %oldc.43406 = phi i32 [ %inc, %syEchoch.exit3070 ], [ %oldc.1.lcssa, %for.body1664.lr.ph ]
 
343
  %4 = load %struct.TMP.2*, %struct.TMP.2** %echo.i3101, align 8, !tbaa !6
 
344
  %call.i3062 = call i32 @fileno(%struct.TMP.2* %4)
 
345
  br i1 undef, label %if.then.i3069, label %syEchoch.exit3070
 
346
 
 
347
if.then.i3069:
 
348
  br label %syEchoch.exit3070
 
349
 
 
350
syEchoch.exit3070:
 
351
  %inc = add i32 %oldc.43406, 1
 
352
  %conv1672 = sext i32 %inc to i64
 
353
  %cmp1677 = icmp slt i64 %conv1672, undef
 
354
  br i1 %cmp1677, label %while.body1679, label %while.cond1683.preheader
 
355
 
 
356
while.body1691:
 
357
  unreachable
 
358
 
 
359
while.end1693:
 
360
  unreachable
 
361
 
 
362
for.body1723:
 
363
  %q.303203 = phi i8* [ getelementptr inbounds ([8192 x i8], [8192 x i8]* @syHistory, i64 0, i64 8189), %if.then1477 ], [ %incdec.ptr1730, %for.body1723 ]
 
364
  %add.ptr1728 = getelementptr i8, i8* %q.303203, i64 %idx.neg1727
 
365
  %5 = load i8, i8* %add.ptr1728, align 1, !tbaa !5
 
366
  %incdec.ptr1730 = getelementptr i8, i8* %q.303203, i64 -1
 
367
  br label %for.body1723
 
368
 
 
369
cleanup:
 
370
  ret i8* undef
 
371
}
 
372
 
 
373
declare i32 @fileno(%struct.TMP.2* nocapture)
 
374
declare i64 @"\01_write"(i32, i8*, i64)
 
375
declare i32 @__maskrune(i32, i64)
 
376
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1)
 
377
 
 
378
!llvm.ident = !{!0}
 
379
 
 
380
!0 = !{!"clang version 3.5.0 (trunk 204257)"}
 
381
!1 = !{!2, !2, i64 0}
 
382
!2 = !{!"int", !3, i64 0}
 
383
!3 = !{!"omnipotent char", !4, i64 0}
 
384
!4 = !{!"Simple C/C++ TBAA"}
 
385
!5 = !{!3, !3, i64 0}
 
386
!6 = !{!7, !8, i64 8}
 
387
!7 = !{!"", !8, i64 0, !8, i64 8, !3, i64 16}
 
388
!8 = !{!"any pointer", !3, i64 0}