@@ -39,11 +39,13 @@ define i32 @caller_i64_in_regs() nounwind {
3939 ; ILP32: bb.1 (%ir-block.0):
4040 ; ILP32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
4141 ; ILP32-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
42+ ; ILP32-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
4243 ; ILP32-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C1]](s64)
4344 ; ILP32-NEXT: $x10 = COPY [[C]](s32)
4445 ; ILP32-NEXT: $x11 = COPY [[UV]](s32)
4546 ; ILP32-NEXT: $x12 = COPY [[UV1]](s32)
4647 ; ILP32-NEXT: PseudoCALL target-flags(riscv-call) @callee_i64_in_regs, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit-def $x10
48+ ; ILP32-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
4749 ; ILP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
4850 ; ILP32-NEXT: $x10 = COPY [[COPY]](s32)
4951 ; ILP32-NEXT: PseudoRET implicit $x10
@@ -52,11 +54,13 @@ define i32 @caller_i64_in_regs() nounwind {
5254 ; ILP32F: bb.1 (%ir-block.0):
5355 ; ILP32F-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
5456 ; ILP32F-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
57+ ; ILP32F-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
5558 ; ILP32F-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C1]](s64)
5659 ; ILP32F-NEXT: $x10 = COPY [[C]](s32)
5760 ; ILP32F-NEXT: $x11 = COPY [[UV]](s32)
5861 ; ILP32F-NEXT: $x12 = COPY [[UV1]](s32)
5962 ; ILP32F-NEXT: PseudoCALL target-flags(riscv-call) @callee_i64_in_regs, csr_ilp32f_lp64f, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit-def $x10
63+ ; ILP32F-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
6064 ; ILP32F-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
6165 ; ILP32F-NEXT: $x10 = COPY [[COPY]](s32)
6266 ; ILP32F-NEXT: PseudoRET implicit $x10
@@ -65,11 +69,13 @@ define i32 @caller_i64_in_regs() nounwind {
6569 ; ILP32D: bb.1 (%ir-block.0):
6670 ; ILP32D-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
6771 ; ILP32D-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
72+ ; ILP32D-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
6873 ; ILP32D-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C1]](s64)
6974 ; ILP32D-NEXT: $x10 = COPY [[C]](s32)
7075 ; ILP32D-NEXT: $x11 = COPY [[UV]](s32)
7176 ; ILP32D-NEXT: $x12 = COPY [[UV1]](s32)
7277 ; ILP32D-NEXT: PseudoCALL target-flags(riscv-call) @callee_i64_in_regs, csr_ilp32d_lp64d, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit-def $x10
78+ ; ILP32D-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
7379 ; ILP32D-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
7480 ; ILP32D-NEXT: $x10 = COPY [[COPY]](s32)
7581 ; ILP32D-NEXT: PseudoRET implicit $x10
@@ -136,6 +142,7 @@ define i32 @caller_many_scalars() nounwind {
136142 ; ILP32-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 6
137143 ; ILP32-NEXT: [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 7
138144 ; ILP32-NEXT: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
145+ ; ILP32-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def $x2, implicit $x2
139146 ; ILP32-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[C]](s8)
140147 ; ILP32-NEXT: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[C1]](s16)
141148 ; ILP32-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C3]](s64)
@@ -156,6 +163,7 @@ define i32 @caller_many_scalars() nounwind {
156163 ; ILP32-NEXT: $x16 = COPY [[C5]](s32)
157164 ; ILP32-NEXT: $x17 = COPY [[UV2]](s32)
158165 ; ILP32-NEXT: PseudoCALL target-flags(riscv-call) @callee_many_scalars, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit $x14, implicit $x15, implicit $x16, implicit $x17, implicit-def $x10
166+ ; ILP32-NEXT: ADJCALLSTACKUP 8, 0, implicit-def $x2, implicit $x2
159167 ; ILP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x10
160168 ; ILP32-NEXT: $x10 = COPY [[COPY1]](s32)
161169 ; ILP32-NEXT: PseudoRET implicit $x10
@@ -170,6 +178,7 @@ define i32 @caller_many_scalars() nounwind {
170178 ; ILP32F-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 6
171179 ; ILP32F-NEXT: [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 7
172180 ; ILP32F-NEXT: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
181+ ; ILP32F-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def $x2, implicit $x2
173182 ; ILP32F-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[C]](s8)
174183 ; ILP32F-NEXT: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[C1]](s16)
175184 ; ILP32F-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C3]](s64)
@@ -190,6 +199,7 @@ define i32 @caller_many_scalars() nounwind {
190199 ; ILP32F-NEXT: $x16 = COPY [[C5]](s32)
191200 ; ILP32F-NEXT: $x17 = COPY [[UV2]](s32)
192201 ; ILP32F-NEXT: PseudoCALL target-flags(riscv-call) @callee_many_scalars, csr_ilp32f_lp64f, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit $x14, implicit $x15, implicit $x16, implicit $x17, implicit-def $x10
202+ ; ILP32F-NEXT: ADJCALLSTACKUP 8, 0, implicit-def $x2, implicit $x2
193203 ; ILP32F-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x10
194204 ; ILP32F-NEXT: $x10 = COPY [[COPY1]](s32)
195205 ; ILP32F-NEXT: PseudoRET implicit $x10
@@ -204,6 +214,7 @@ define i32 @caller_many_scalars() nounwind {
204214 ; ILP32D-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 6
205215 ; ILP32D-NEXT: [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 7
206216 ; ILP32D-NEXT: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
217+ ; ILP32D-NEXT: ADJCALLSTACKDOWN 8, 0, implicit-def $x2, implicit $x2
207218 ; ILP32D-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[C]](s8)
208219 ; ILP32D-NEXT: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[C1]](s16)
209220 ; ILP32D-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C3]](s64)
@@ -224,6 +235,7 @@ define i32 @caller_many_scalars() nounwind {
224235 ; ILP32D-NEXT: $x16 = COPY [[C5]](s32)
225236 ; ILP32D-NEXT: $x17 = COPY [[UV2]](s32)
226237 ; ILP32D-NEXT: PseudoCALL target-flags(riscv-call) @callee_many_scalars, csr_ilp32d_lp64d, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit $x14, implicit $x15, implicit $x16, implicit $x17, implicit-def $x10
238+ ; ILP32D-NEXT: ADJCALLSTACKUP 8, 0, implicit-def $x2, implicit $x2
227239 ; ILP32D-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x10
228240 ; ILP32D-NEXT: $x10 = COPY [[COPY1]](s32)
229241 ; ILP32D-NEXT: PseudoRET implicit $x10
@@ -248,7 +260,9 @@ define i32 @caller_small_scalar_ret() nounwind {
248260 ; ILP32-LABEL: name: caller_small_scalar_ret
249261 ; ILP32: bb.1 (%ir-block.0):
250262 ; ILP32-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 987654321234567
263+ ; ILP32-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
251264 ; ILP32-NEXT: PseudoCALL target-flags(riscv-call) @callee_small_scalar_ret, csr_ilp32_lp64, implicit-def $x1, implicit-def $x10, implicit-def $x11
265+ ; ILP32-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
252266 ; ILP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
253267 ; ILP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
254268 ; ILP32-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY]](s32), [[COPY1]](s32)
@@ -260,7 +274,9 @@ define i32 @caller_small_scalar_ret() nounwind {
260274 ; ILP32F-LABEL: name: caller_small_scalar_ret
261275 ; ILP32F: bb.1 (%ir-block.0):
262276 ; ILP32F-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 987654321234567
277+ ; ILP32F-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
263278 ; ILP32F-NEXT: PseudoCALL target-flags(riscv-call) @callee_small_scalar_ret, csr_ilp32f_lp64f, implicit-def $x1, implicit-def $x10, implicit-def $x11
279+ ; ILP32F-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
264280 ; ILP32F-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
265281 ; ILP32F-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
266282 ; ILP32F-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY]](s32), [[COPY1]](s32)
@@ -272,7 +288,9 @@ define i32 @caller_small_scalar_ret() nounwind {
272288 ; ILP32D-LABEL: name: caller_small_scalar_ret
273289 ; ILP32D: bb.1 (%ir-block.0):
274290 ; ILP32D-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 987654321234567
291+ ; ILP32D-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
275292 ; ILP32D-NEXT: PseudoCALL target-flags(riscv-call) @callee_small_scalar_ret, csr_ilp32d_lp64d, implicit-def $x1, implicit-def $x10, implicit-def $x11
293+ ; ILP32D-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
276294 ; ILP32D-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
277295 ; ILP32D-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
278296 ; ILP32D-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY]](s32), [[COPY1]](s32)
@@ -304,7 +322,9 @@ define %struct.small @callee_small_struct_ret() nounwind {
304322define i32 @caller_small_struct_ret () nounwind {
305323 ; ILP32-LABEL: name: caller_small_struct_ret
306324 ; ILP32: bb.1 (%ir-block.0):
325+ ; ILP32-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
307326 ; ILP32-NEXT: PseudoCALL target-flags(riscv-call) @callee_small_struct_ret, csr_ilp32_lp64, implicit-def $x1, implicit-def $x10, implicit-def $x11
327+ ; ILP32-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
308328 ; ILP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
309329 ; ILP32-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
310330 ; ILP32-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY1]](p0)
@@ -314,7 +334,9 @@ define i32 @caller_small_struct_ret() nounwind {
314334 ;
315335 ; ILP32F-LABEL: name: caller_small_struct_ret
316336 ; ILP32F: bb.1 (%ir-block.0):
337+ ; ILP32F-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
317338 ; ILP32F-NEXT: PseudoCALL target-flags(riscv-call) @callee_small_struct_ret, csr_ilp32f_lp64f, implicit-def $x1, implicit-def $x10, implicit-def $x11
339+ ; ILP32F-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
318340 ; ILP32F-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
319341 ; ILP32F-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
320342 ; ILP32F-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY1]](p0)
@@ -324,7 +346,9 @@ define i32 @caller_small_struct_ret() nounwind {
324346 ;
325347 ; ILP32D-LABEL: name: caller_small_struct_ret
326348 ; ILP32D: bb.1 (%ir-block.0):
349+ ; ILP32D-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
327350 ; ILP32D-NEXT: PseudoCALL target-flags(riscv-call) @callee_small_struct_ret, csr_ilp32d_lp64d, implicit-def $x1, implicit-def $x10, implicit-def $x11
351+ ; ILP32D-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
328352 ; ILP32D-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
329353 ; ILP32D-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
330354 ; ILP32D-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY1]](p0)
@@ -378,8 +402,10 @@ define i32 @caller_large_struct_ret() nounwind {
378402 ; ILP32-LABEL: name: caller_large_struct_ret
379403 ; ILP32: bb.1 (%ir-block.0):
380404 ; ILP32-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0
405+ ; ILP32-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
381406 ; ILP32-NEXT: $x10 = COPY [[FRAME_INDEX]](p0)
382407 ; ILP32-NEXT: PseudoCALL target-flags(riscv-call) @callee_large_struct_ret, csr_ilp32_lp64, implicit-def $x1, implicit $x10
408+ ; ILP32-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
383409 ; ILP32-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (dereferenceable load (s32) from %ir.1)
384410 ; ILP32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 12
385411 ; ILP32-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = nuw G_PTR_ADD [[FRAME_INDEX]], [[C]](s32)
@@ -391,8 +417,10 @@ define i32 @caller_large_struct_ret() nounwind {
391417 ; ILP32F-LABEL: name: caller_large_struct_ret
392418 ; ILP32F: bb.1 (%ir-block.0):
393419 ; ILP32F-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0
420+ ; ILP32F-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
394421 ; ILP32F-NEXT: $x10 = COPY [[FRAME_INDEX]](p0)
395422 ; ILP32F-NEXT: PseudoCALL target-flags(riscv-call) @callee_large_struct_ret, csr_ilp32f_lp64f, implicit-def $x1, implicit $x10
423+ ; ILP32F-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
396424 ; ILP32F-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (dereferenceable load (s32) from %ir.1)
397425 ; ILP32F-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 12
398426 ; ILP32F-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = nuw G_PTR_ADD [[FRAME_INDEX]], [[C]](s32)
@@ -404,8 +432,10 @@ define i32 @caller_large_struct_ret() nounwind {
404432 ; ILP32D-LABEL: name: caller_large_struct_ret
405433 ; ILP32D: bb.1 (%ir-block.0):
406434 ; ILP32D-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0
435+ ; ILP32D-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
407436 ; ILP32D-NEXT: $x10 = COPY [[FRAME_INDEX]](p0)
408437 ; ILP32D-NEXT: PseudoCALL target-flags(riscv-call) @callee_large_struct_ret, csr_ilp32d_lp64d, implicit-def $x1, implicit $x10
438+ ; ILP32D-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
409439 ; ILP32D-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (dereferenceable load (s32) from %ir.1)
410440 ; ILP32D-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 12
411441 ; ILP32D-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = nuw G_PTR_ADD [[FRAME_INDEX]], [[C]](s32)
0 commit comments