1# RUN: llc -mtriple=s390x-linux-gnu -start-before=prologepilog %s -o - -print-after=prologepilog \
2# RUN:  -verify-machineinstrs 2>&1 | FileCheck %s
3# REQUIRES: asserts
4#
5# Test that R6 when used for an argument is modelled as being live throughout
6# the function when not saved in the prologue..
7
8# CHECK:      # *** IR Dump After Prologue/Epilogue Insertion & Frame Finalization ***:
9# CHECK-NEXT: # Machine code for function fun0:
10# CHECK-LABEL: bb.0:
11# CHECK: liveins:{{.*}} $r6d
12# CHECK: STMG killed $r7d, killed $r15d
13# CHECK: STG renamable $r6d
14# CHECK: End machine code for function fun0.
15
16
17--- |
18
19  @g_181 = external dso_local global i32, align 4
20  @g_1390 = external dso_local constant i64*, align 8
21
22  define internal i8 @fun0(i8 %arg, i8 %arg1, i32 %arg2, i8 %arg3, i32* %arg4, float %F0, float %F1) #0 {
23    ret i8 0
24  }
25
26  ; Same function but in a single block which will make the verifier complain
27  ; if R6 is killed by the original store before the point where the
28  ; RegScavenger inserts its (killing) store of R6.
29  define internal i8 @fun1(i8 %arg, i8 %arg1, i32 %arg2, i8 %arg3, i32* %arg4) #0 {
30    ret i8 0
31  }
32
33  attributes #0 = { "frame-pointer"="all" }
34
35...
36---
37name:            fun0
38alignment:       16
39tracksRegLiveness: true
40liveins:
41  - { reg: '$r6d' }
42  - { reg: '$f0s' }
43  - { reg: '$f2s' }
44frameInfo:
45  maxAlignment:    8
46stack:
47  - { id: 0, size: 96, alignment: 8 }
48  - { id: 1, size: 1960, alignment: 8 }
49  - { id: 2, size: 8, alignment: 8 }
50  - { id: 3, size: 320, alignment: 8 }
51  - { id: 4, size: 4, alignment: 4 }
52  - { id: 5, size: 8, alignment: 8 }
53  - { id: 6, size: 8, alignment: 8 }
54  - { id: 7, size: 4, alignment: 4 }
55  - { id: 8, size: 8, alignment: 8 }
56  - { id: 9, size: 4, alignment: 4 }
57  - { id: 10, size: 8, alignment: 8 }
58  - { id: 11, size: 8, alignment: 8 }
59  - { id: 12, size: 8, alignment: 8 }
60  - { id: 13, size: 8, alignment: 8 }
61  - { id: 14, size: 24, alignment: 4 }
62  - { id: 15, size: 4, alignment: 4 }
63  - { id: 16, size: 1792, alignment: 8 }
64  - { id: 17, size: 8, alignment: 8 }
65  - { id: 18, size: 8, alignment: 8 }
66  - { id: 19, size: 8, alignment: 8 }
67  - { id: 20, size: 1, alignment: 2 }
68  - { id: 21, size: 672, alignment: 8 }
69  - { id: 22, size: 4, alignment: 4 }
70  - { id: 23, size: 4, alignment: 4 }
71  - { id: 24, size: 4, alignment: 4 }
72  - { id: 25, size: 64, alignment: 8 }
73machineFunctionInfo: {}
74body:             |
75  bb.0:
76    liveins: $f0s, $f2s, $r6d
77
78    STG killed renamable $r6d, undef renamable $r1d, 0, $noreg :: (store 8 into `i32** undef`)
79    renamable $r0d = LARL @g_181
80    nofpexcept CEBR renamable $f0s, renamable $f2s, implicit-def $cc, implicit $fpc
81    STG renamable $r0d, undef renamable $r1d, 0, $noreg :: (store 8 into `i32** undef`)
82    BRC 15, 4, %bb.2, implicit killed $cc
83
84  bb.1:
85    liveins: $f2s, $r0d
86
87    renamable $f0s = COPY killed renamable $f2s
88
89  bb.2:
90    liveins: $f0s, $r0d
91
92    STE killed renamable $f0s, undef renamable $r1d, 0, $noreg :: (volatile store 4 into `float* undef`)
93    renamable $r1d = nuw LA %stack.0, 16, $noreg
94    renamable $r2d = nuw LA %stack.0, 24, $noreg
95    renamable $r3d = LA %stack.0, 40, $noreg
96    renamable $r4d = LARL @g_1390
97    STG renamable $r4d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
98    renamable $r5d = nuw LA %stack.0, 48, $noreg
99    renamable $r14d = LA %stack.0, 72, $noreg
100    renamable $r13d = LA %stack.0, 80, $noreg
101    renamable $r12d = LA %stack.0, 56, $noreg
102    renamable $r10d = LA %stack.0, 0, $noreg
103    STG renamable $r10d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
104    renamable $r9d = LA %stack.0, 64, $noreg
105    renamable $r8d = LA %stack.0, 88, $noreg
106    renamable $r7d = nuw LA %stack.0, 8, $noreg
107    MVGHI %stack.1, 904, 0
108    STG killed renamable $r9d, $noreg, 0, $noreg :: (store 8 into `i64*** null`)
109    STG killed renamable $r3d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
110    STG killed renamable $r14d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
111    STG killed renamable $r7d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
112    STG killed renamable $r1d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
113    STG killed renamable $r4d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
114    STG killed renamable $r2d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
115    STG killed renamable $r5d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
116    STG killed renamable $r8d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
117    STG killed renamable $r12d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
118    STG killed renamable $r13d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
119    STG killed renamable $r10d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
120    $r2l = LHI 0
121    STG killed renamable $r0d, undef renamable $r1d, 0, $noreg :: (store 8 into `i32** undef`)
122    Return implicit $r2l
123
124...
125---
126name:            fun1
127alignment:       16
128tracksRegLiveness: true
129liveins:
130  - { reg: '$r6d' }
131frameInfo:
132  maxAlignment:    8
133stack:
134  - { id: 0, size: 96, alignment: 8 }
135  - { id: 1, size: 1960, alignment: 8 }
136  - { id: 2, size: 8, alignment: 8 }
137  - { id: 3, size: 320, alignment: 8 }
138  - { id: 4, size: 4, alignment: 4 }
139  - { id: 5, size: 8, alignment: 8 }
140  - { id: 6, size: 8, alignment: 8 }
141  - { id: 7, size: 4, alignment: 4 }
142  - { id: 8, size: 8, alignment: 8 }
143  - { id: 9, size: 4, alignment: 4 }
144  - { id: 10, size: 8, alignment: 8 }
145  - { id: 11, size: 8, alignment: 8 }
146  - { id: 12, size: 8, alignment: 8 }
147  - { id: 13, size: 8, alignment: 8 }
148  - { id: 14, size: 24, alignment: 4 }
149  - { id: 15, size: 4, alignment: 4 }
150  - { id: 16, size: 1792, alignment: 8 }
151  - { id: 17, size: 8, alignment: 8 }
152  - { id: 18, size: 8, alignment: 8 }
153  - { id: 19, size: 8, alignment: 8 }
154  - { id: 20, size: 1, alignment: 2 }
155  - { id: 21, size: 672, alignment: 8 }
156  - { id: 22, size: 4, alignment: 4 }
157  - { id: 23, size: 4, alignment: 4 }
158  - { id: 24, size: 4, alignment: 4 }
159  - { id: 25, size: 64, alignment: 8 }
160machineFunctionInfo: {}
161body:             |
162  bb.0:
163    liveins: $r6d
164
165    STG killed renamable $r6d, undef renamable $r1d, 0, $noreg :: (store 8 into `i32** undef`)
166    renamable $r0d = LARL @g_181
167    STG renamable $r0d, undef renamable $r1d, 0, $noreg :: (store 8 into `i32** undef`)
168    renamable $r1d = nuw LA %stack.0, 16, $noreg
169    renamable $r2d = nuw LA %stack.0, 24, $noreg
170    renamable $r3d = LA %stack.0, 40, $noreg
171    renamable $r4d = LARL @g_1390
172    STG renamable $r4d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
173    renamable $r5d = nuw LA %stack.0, 48, $noreg
174    renamable $r14d = LA %stack.0, 72, $noreg
175    renamable $r13d = LA %stack.0, 80, $noreg
176    renamable $r12d = LA %stack.0, 56, $noreg
177    renamable $r10d = LA %stack.0, 0, $noreg
178    STG renamable $r10d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
179    renamable $r9d = LA %stack.0, 64, $noreg
180    renamable $r8d = LA %stack.0, 88, $noreg
181    renamable $r7d = nuw LA %stack.0, 8, $noreg
182    MVGHI %stack.1, 904, 0
183    STG killed renamable $r9d, $noreg, 0, $noreg :: (store 8 into `i64*** null`)
184    STG killed renamable $r3d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
185    STG killed renamable $r14d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
186    STG killed renamable $r7d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
187    STG killed renamable $r1d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
188    STG killed renamable $r4d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
189    STG killed renamable $r2d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
190    STG killed renamable $r5d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
191    STG killed renamable $r8d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
192    STG killed renamable $r12d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
193    STG killed renamable $r13d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
194    STG killed renamable $r10d, undef renamable $r1d, 0, $noreg :: (store 8 into `i64*** undef`)
195    $r2l = LHI 0
196    STG killed renamable $r0d, undef renamable $r1d, 0, $noreg :: (store 8 into `i32** undef`)
197    Return implicit $r2l
198
199...
200