1#RUN: llc -o - %s -mtriple=s390x-ibm-linux -run-pass=greedy
2#PR34502. Check HoistSpill works properly after the live range of spilled
3#virtual register is cleared.
4--- |
5  ; ModuleID = 'hoistspills_crash.ll'
6  source_filename = "bugpoint-output-07170c2.bc"
7  target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
8  target triple = "s390x-ibm-linux"
9
10  @best8x8mode = external local_unnamed_addr global [4 x i16], align 2
11  @best8x8fwref = external local_unnamed_addr global [15 x [4 x i16]], align 2
12  @rec_mbY8x8 = external local_unnamed_addr global [16 x [16 x i16]], align 2
13  @bi_pred_me = external local_unnamed_addr global i32, align 4
14
15  declare signext i32 @Get_Direct_Cost8x8(i32 signext, i32*) local_unnamed_addr #0
16  declare void @store_coding_state(i32*) local_unnamed_addr #0
17  declare void @reset_coding_state(i32*) local_unnamed_addr #0
18  declare void @SetRefAndMotionVectors(i32 signext, i32 signext, i32 signext, i32 signext, i32 signext) local_unnamed_addr #2
19  declare signext i32 @Get_Direct_CostMB(double) local_unnamed_addr #0
20  declare void @SetModesAndRefframeForBlocks(i32 signext) local_unnamed_addr #1
21
22  define void @encode_one_macroblock() { ret void }
23---
24name:            encode_one_macroblock
25alignment:       4
26tracksRegLiveness: true
27registers:
28  - { id: 0, class: addr64bit }
29  - { id: 1, class: addr64bit }
30  - { id: 2, class: grx32bit }
31  - { id: 3, class: grx32bit }
32  - { id: 4, class: gr32bit }
33  - { id: 5, class: gr32bit }
34  - { id: 6, class: addr64bit }
35  - { id: 7, class: addr64bit }
36  - { id: 8, class: gr64bit }
37  - { id: 9, class: grx32bit }
38  - { id: 10, class: gr32bit }
39  - { id: 11, class: grx32bit }
40  - { id: 12, class: gr32bit }
41  - { id: 13, class: grx32bit }
42  - { id: 14, class: gr32bit }
43  - { id: 15, class: grx32bit }
44  - { id: 16, class: grx32bit }
45  - { id: 17, class: gr32bit }
46  - { id: 18, class: gr32bit }
47  - { id: 19, class: gr64bit }
48  - { id: 20, class: grx32bit }
49  - { id: 21, class: grx32bit }
50  - { id: 22, class: addr64bit }
51  - { id: 23, class: grx32bit }
52  - { id: 24, class: grx32bit }
53  - { id: 25, class: grx32bit }
54  - { id: 26, class: grx32bit }
55  - { id: 27, class: grx32bit }
56  - { id: 28, class: grx32bit }
57  - { id: 29, class: grx32bit }
58  - { id: 30, class: grx32bit }
59  - { id: 31, class: grx32bit }
60  - { id: 32, class: grx32bit }
61  - { id: 33, class: grx32bit }
62  - { id: 34, class: grx32bit }
63  - { id: 35, class: grx32bit }
64  - { id: 36, class: grx32bit }
65  - { id: 37, class: gr64bit }
66  - { id: 38, class: gr32bit }
67  - { id: 39, class: grx32bit }
68  - { id: 40, class: addr64bit }
69  - { id: 41, class: addr64bit }
70  - { id: 42, class: gr64bit }
71  - { id: 43, class: gr32bit }
72  - { id: 44, class: gr32bit }
73  - { id: 45, class: gr32bit }
74  - { id: 46, class: gr32bit }
75  - { id: 47, class: gr32bit }
76  - { id: 48, class: grx32bit }
77  - { id: 49, class: gr64bit }
78  - { id: 50, class: gr64bit }
79  - { id: 51, class: gr64bit }
80  - { id: 52, class: gr32bit }
81  - { id: 53, class: gr32bit }
82  - { id: 54, class: grx32bit }
83  - { id: 55, class: gr32bit }
84  - { id: 56, class: grx32bit }
85  - { id: 57, class: grx32bit }
86  - { id: 58, class: gr64bit }
87  - { id: 59, class: gr64bit }
88  - { id: 60, class: gr32bit }
89  - { id: 61, class: grx32bit }
90  - { id: 62, class: addr64bit }
91  - { id: 63, class: addr64bit }
92  - { id: 64, class: addr64bit }
93  - { id: 65, class: addr64bit }
94  - { id: 66, class: addr64bit }
95  - { id: 67, class: addr64bit }
96  - { id: 68, class: addr64bit }
97  - { id: 69, class: addr64bit }
98  - { id: 70, class: addr64bit }
99  - { id: 71, class: gr64bit }
100  - { id: 72, class: addr64bit }
101  - { id: 73, class: grx32bit }
102  - { id: 74, class: gr64bit }
103  - { id: 75, class: addr64bit }
104  - { id: 76, class: addr64bit }
105  - { id: 77, class: addr64bit }
106  - { id: 78, class: addr64bit }
107  - { id: 79, class: gr32bit }
108  - { id: 80, class: grx32bit }
109  - { id: 81, class: gr64bit }
110  - { id: 82, class: addr64bit }
111  - { id: 83, class: grx32bit }
112  - { id: 84, class: addr64bit }
113  - { id: 85, class: addr64bit }
114  - { id: 86, class: addr64bit }
115  - { id: 87, class: grx32bit }
116  - { id: 88, class: addr64bit }
117  - { id: 89, class: addr64bit }
118  - { id: 90, class: gr64bit }
119  - { id: 91, class: addr64bit }
120  - { id: 92, class: addr64bit }
121  - { id: 93, class: addr64bit }
122  - { id: 94, class: addr64bit }
123  - { id: 95, class: addr64bit }
124  - { id: 96, class: addr64bit }
125  - { id: 97, class: addr64bit }
126  - { id: 98, class: gr64bit }
127  - { id: 99, class: gr64bit }
128  - { id: 100, class: addr64bit }
129  - { id: 101, class: gr64bit }
130  - { id: 102, class: gr64bit }
131  - { id: 103, class: gr64bit }
132  - { id: 104, class: gr64bit }
133  - { id: 105, class: addr64bit }
134  - { id: 106, class: grx32bit }
135  - { id: 107, class: grx32bit }
136  - { id: 108, class: vr64bit }
137  - { id: 109, class: gr64bit }
138  - { id: 110, class: gr64bit }
139  - { id: 111, class: grx32bit }
140  - { id: 112, class: grx32bit }
141  - { id: 113, class: fp64bit }
142  - { id: 114, class: grx32bit }
143  - { id: 115, class: fp64bit }
144  - { id: 116, class: fp64bit }
145  - { id: 117, class: addr64bit }
146  - { id: 118, class: grx32bit }
147  - { id: 119, class: grx32bit }
148  - { id: 120, class: addr64bit }
149  - { id: 121, class: grx32bit }
150  - { id: 122, class: grx32bit }
151  - { id: 123, class: gr32bit }
152  - { id: 124, class: gr32bit }
153  - { id: 125, class: gr32bit }
154  - { id: 126, class: gr32bit }
155  - { id: 127, class: gr32bit }
156  - { id: 128, class: grx32bit }
157  - { id: 129, class: grx32bit }
158  - { id: 130, class: fp64bit }
159frameInfo:
160  hasCalls:        true
161body:             |
162  bb.0:
163    successors: %bb.2(0x00000001), %bb.1(0x7fffffff)
164
165    CHIMux undef %20, 3, implicit-def $cc
166    BRC 14, 8, %bb.2, implicit killed $cc
167    J %bb.1
168
169  bb.1:
170    successors: %bb.2(0x00000001), %bb.3(0x7fffffff)
171
172    CHIMux undef %21, 0, implicit-def $cc
173    BRC 14, 6, %bb.3, implicit killed $cc
174    J %bb.2
175
176  bb.2:
177
178  bb.3:
179    successors: %bb.6(0x00000001), %bb.4(0x7fffffff)
180
181    CHIMux undef %23, 2, implicit-def $cc
182    BRC 14, 8, %bb.6, implicit killed $cc
183    J %bb.4
184
185  bb.4:
186    successors: %bb.5(0x00000001), %bb.7(0x7fffffff)
187
188    CHIMux undef %24, 1, implicit-def $cc
189    BRC 14, 6, %bb.7, implicit killed $cc
190    J %bb.5
191
192  bb.5:
193
194  bb.6:
195
196  bb.7:
197    successors: %bb.47(0x00000001), %bb.8(0x7fffffff)
198
199    CHIMux undef %25, 1, implicit-def $cc
200    BRC 14, 8, %bb.47, implicit killed $cc
201    J %bb.8
202
203  bb.8:
204    successors: %bb.46(0x00000001), %bb.48(0x7fffffff)
205
206    CHIMux undef %26, 2, implicit-def $cc
207    BRC 14, 8, %bb.46, implicit killed $cc
208    J %bb.48
209
210  bb.9:
211    successors: %bb.36(0x00000001), %bb.10(0x7fffffff)
212
213    CHIMux undef %31, 1, implicit-def $cc
214    BRC 14, 8, %bb.36, implicit killed $cc
215    J %bb.10
216
217  bb.10:
218    successors: %bb.35(0x00000001), %bb.37(0x7fffffff)
219
220    CHIMux undef %32, 2, implicit-def $cc
221    BRC 14, 8, %bb.35, implicit killed $cc
222    J %bb.37
223
224  bb.11:
225    %4 = COPY %60
226    %6 = SLLG %120, $noreg, 1
227    %7 = LA %6, 64, %41
228    %6 = AGR %6, %42, implicit-def dead $cc
229    %45 = SRLK %120.subreg_l32, $noreg, 31
230    %45 = AR %45, %120.subreg_l32, implicit-def dead $cc
231    %45 = NIFMux %45, 536870910, implicit-def dead $cc
232    %47 = SRK %120.subreg_l32, %45, implicit-def dead $cc
233    %47 = SLL %47, $noreg, 3
234    %81 = LGFR %47
235
236  bb.12:
237    successors: %bb.56, %bb.13
238
239    CHIMux %38, 0, implicit-def $cc
240    BRC 14, 8, %bb.13, implicit killed $cc
241
242  bb.56:
243    J %bb.16
244
245  bb.13:
246    successors: %bb.14(0x7fffffff), %bb.15(0x00000001)
247
248    ADJCALLSTACKDOWN 0, 0
249    %49 = LGFR %120.subreg_l32
250    $r2d = COPY %49
251    CallBRASL @Get_Direct_Cost8x8, killed $r2d, undef $r3d, csr_systemz, implicit-def dead $r14d, implicit-def dead $cc, implicit-def $r2d
252    ADJCALLSTACKUP 0, 0
253    %51 = COPY killed $r2d
254    MVHHI %7, 0, 0 :: (store 2)
255    %12 = ARK %51.subreg_l32, %125, implicit-def dead $cc
256    CFIMux %51.subreg_l32, 2147483647, implicit-def $cc
257    %12 = LOCRMux %12, %126, 14, 8, implicit killed $cc
258    CFIMux %125, 2147483647, implicit-def $cc
259    %12 = LOCRMux %12, %126, 14, 8, implicit killed $cc
260    CHIMux undef %56, 0, implicit-def $cc
261    BRC 14, 6, %bb.15, implicit killed $cc
262    J %bb.14
263
264  bb.14:
265    %124 = AHIMux %124, 1, implicit-def dead $cc
266    ADJCALLSTACKDOWN 0, 0
267    CallBRASL @store_coding_state, undef $r2d, csr_systemz, implicit-def dead $r14d, implicit-def dead $cc
268    ADJCALLSTACKUP 0, 0
269    %125 = COPY %12
270    J %bb.16
271
272  bb.15:
273
274  bb.16:
275    successors: %bb.12(0x7c000000), %bb.17(0x04000000)
276
277    CLGFI undef %59, 4, implicit-def $cc
278    BRC 14, 4, %bb.12, implicit killed $cc
279    J %bb.17
280
281  bb.17:
282    successors: %bb.18, %bb.19
283
284    MVHI %0, 332, 2 :: (store 4)
285    %60 = COPY %126
286    %60 = AR %60, %4, implicit-def dead $cc
287    %18 = LHMux %6, 0, $noreg :: (load 2)
288    CHIMux %38, 0, implicit-def $cc
289    BRC 14, 6, %bb.19, implicit killed $cc
290    J %bb.18
291
292  bb.18:
293    %62 = SLLG %81, $noreg, 1
294    %64 = LA %62, 0, %63
295    %65 = LG undef %66, 0, $noreg :: (load 8)
296    %67 = LGF undef %68, 0, $noreg :: (load 4)
297    MVC undef %69, 0, 2, %64, 0 :: (store 2), (load 2)
298    %70 = COPY %81
299    %70 = OILL64 %70, 3, implicit-def dead $cc
300    %71 = LA %70, 2, $noreg
301    %72 = SLLG %71, $noreg, 1
302    %73 = LHMux %72, 0, %63 :: (load 2)
303    %74 = LA %70, 2, %67
304    %75 = SLLG %74, $noreg, 1
305    %76 = LG %65, 0, $noreg :: (load 8)
306    STHMux %73, %76, 0, %75 :: (store 2)
307    %77 = LG undef %78, 0, $noreg :: (load 8)
308    %79 = LHRL @rec_mbY8x8 :: (load 2)
309    STHMux %79, %77, 0, $noreg :: (store 2)
310    %80 = LHMux %72, 0, %63 :: (load 2)
311    STHMux %80, %77, 0, %75 :: (store 2)
312    %81 = OILL64 %81, 7, implicit-def dead $cc
313    %82 = SLLG %81, $noreg, 1
314    %83 = LHMux %82, 0, %63 :: (load 2)
315    STHMux %83, %77, 0, $noreg :: (store 2)
316    %84 = LA %62, 64, %63
317    MVC undef %85, 0, 2, %84, 0 :: (store 2), (load 2)
318    %86 = SLLG %70, $noreg, 1
319    %87 = LHMux %86, 64, %63 :: (load 2)
320    %88 = SLLG %67, $noreg, 3
321    %89 = LG %65, 16, %88 :: (load 8)
322    %90 = LA %70, 0, %67
323    %91 = SLLG %90, $noreg, 1
324    STHMux %87, %89, 0, %91 :: (store 2)
325    %92 = LA %72, 64, %63
326    MVC undef %93, 0, 2, %92, 0 :: (store 2), (load 2)
327    %94 = LA %86, 6, %63
328    MVC undef %95, 0, 2, %94, 0 :: (store 2), (load 2)
329    %96 = LA %82, 0, %63
330    MVC undef %97, 0, 2, %96, 0 :: (store 2), (load 2)
331
332  bb.19:
333    successors: %bb.20(0x04000000), %bb.11(0x7c000000)
334
335    %98 = LGH %7, 0, $noreg :: (load 2)
336    %99 = LGH undef %100, 0, $noreg :: (load 2)
337    ADJCALLSTACKDOWN 0, 0
338    %101 = LGFR %120.subreg_l32
339    %102 = LGFR %18
340    $r2d = COPY %101
341    $r3d = COPY %102
342    $r4d = LGHI 0
343    $r5d = COPY %98
344    $r6d = COPY %99
345    CallBRASL @SetRefAndMotionVectors, killed $r2d, killed $r3d, killed $r4d, killed $r5d, killed $r6d, csr_systemz, implicit-def dead $r14d, implicit-def dead $cc
346    ADJCALLSTACKUP 0, 0
347    ADJCALLSTACKDOWN 0, 0
348    CallBRASL @reset_coding_state, undef $r2d, csr_systemz, implicit-def dead $r14d, implicit-def dead $cc
349    ADJCALLSTACKUP 0, 0
350    %120 = LA %120, 1, $noreg
351    CGHI %120, 4, implicit-def $cc
352    BRC 14, 6, %bb.11, implicit killed $cc
353    J %bb.20
354
355  bb.20:
356    successors: %bb.22(0x00000001), %bb.21(0x7fffffff)
357
358    MVHI undef %105, 0, 0 :: (store 4)
359    CHIMux undef %106, 3, implicit-def $cc
360    BRC 14, 8, %bb.22, implicit killed $cc
361    J %bb.21
362
363  bb.21:
364    successors: %bb.22(0x00000001), %bb.23(0x7fffffff)
365
366    CHIMux undef %107, 0, implicit-def $cc
367    BRC 14, 6, %bb.23, implicit killed $cc
368    J %bb.22
369
370  bb.22:
371
372  bb.23:
373    successors: %bb.26(0x00000001), %bb.24(0x7fffffff)
374
375    ADJCALLSTACKDOWN 0, 0
376    CallBRASL @Get_Direct_CostMB, undef $f0d, csr_systemz, implicit-def dead $r14d, implicit-def dead $cc, implicit-def dead $r2d
377    ADJCALLSTACKUP 0, 0
378    ADJCALLSTACKDOWN 0, 0
379    $r2d = LGHI 0
380    CallBRASL @SetModesAndRefframeForBlocks, killed $r2d, csr_systemz, implicit-def dead $r14d, implicit-def dead $cc
381    ADJCALLSTACKUP 0, 0
382    CHIMux undef %111, 13, implicit-def $cc
383    BRC 14, 8, %bb.26, implicit killed $cc
384    J %bb.24
385
386  bb.24:
387    successors: %bb.25(0x00000001), %bb.27(0x7fffffff)
388
389    CHIMux undef %112, 8, implicit-def $cc
390    BRC 14, 6, %bb.27, implicit killed $cc
391    J %bb.25
392
393  bb.25:
394
395  bb.26:
396
397  bb.27:
398    successors: %bb.28, %bb.29
399
400    CHIMux undef %114, 0, implicit-def $cc
401    BRC 14, 6, %bb.29, implicit killed $cc
402
403  bb.28:
404    %130 = CDFBR %60, implicit $fpc
405    J %bb.30
406
407  bb.29:
408    %130 = IMPLICIT_DEF
409
410  bb.30:
411    successors: %bb.33(0x00000001), %bb.31(0x7fffffff)
412
413    VST64 %130, undef %117, 0, $noreg :: (store 8)
414    CHIMux undef %118, 2, implicit-def $cc
415    BRC 14, 8, %bb.33, implicit killed $cc
416    J %bb.31
417
418  bb.31:
419    successors: %bb.32(0x00000001), %bb.34(0x7fffffff)
420
421    CHIMux undef %119, 1, implicit-def $cc
422    BRC 14, 6, %bb.34, implicit killed $cc
423    J %bb.32
424
425  bb.32:
426
427  bb.33:
428
429  bb.34:
430    Return
431
432  bb.35:
433
434  bb.36:
435
436  bb.37:
437    successors: %bb.40(0x00000001), %bb.38(0x7fffffff)
438
439    CHIMux undef %33, 1, implicit-def $cc
440    BRC 14, 8, %bb.40, implicit killed $cc
441    J %bb.38
442
443  bb.38:
444    successors: %bb.39(0x00000001), %bb.41(0x7fffffff)
445
446    CHIMux undef %34, 2, implicit-def $cc
447    BRC 14, 6, %bb.41, implicit killed $cc
448    J %bb.39
449
450  bb.39:
451
452  bb.40:
453
454  bb.41:
455    successors: %bb.44(0x00000001), %bb.42(0x7fffffff)
456
457    CHIMux undef %35, 1, implicit-def $cc
458    BRC 14, 8, %bb.44, implicit killed $cc
459    J %bb.42
460
461  bb.42:
462    successors: %bb.43(0x00000001), %bb.45(0x7fffffff)
463
464    CHIMux undef %36, 2, implicit-def $cc
465    BRC 14, 6, %bb.45, implicit killed $cc
466    J %bb.43
467
468  bb.43:
469
470  bb.44:
471
472  bb.45:
473    %0 = LG undef %22, 0, $noreg :: (load 8)
474    %38 = LHIMux 0
475    STRL %38, @bi_pred_me :: (store 4)
476    %120 = LGHI 0
477    %41 = LARL @best8x8fwref
478    %42 = LARL @best8x8mode
479    %63 = LARL @rec_mbY8x8
480    %126 = IIFMux 2147483647
481    %124 = LHIMux 0
482    %125 = LHIMux 0
483    %60 = LHIMux 0
484    J %bb.11
485
486  bb.46:
487
488  bb.47:
489
490  bb.48:
491    successors: %bb.51(0x00000001), %bb.49(0x7fffffff)
492
493    CHIMux undef %27, 1, implicit-def $cc
494    BRC 14, 8, %bb.51, implicit killed $cc
495    J %bb.49
496
497  bb.49:
498    successors: %bb.50(0x00000001), %bb.52(0x7fffffff)
499
500    CHIMux undef %28, 2, implicit-def $cc
501    BRC 14, 6, %bb.52, implicit killed $cc
502    J %bb.50
503
504  bb.50:
505
506  bb.51:
507
508  bb.52:
509    successors: %bb.55(0x00000001), %bb.53(0x7fffffff)
510
511    CHIMux undef %29, 1, implicit-def $cc
512    BRC 14, 8, %bb.55, implicit killed $cc
513    J %bb.53
514
515  bb.53:
516    successors: %bb.54(0x00000001), %bb.9(0x7fffffff)
517
518    CHIMux undef %30, 2, implicit-def $cc
519    BRC 14, 6, %bb.9, implicit killed $cc
520    J %bb.54
521
522  bb.54:
523
524  bb.55:
525
526...
527