mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-01 00:12:50 +01:00
adb91e7ed9
Introduction: In case when stack alignment is 8 and GPRs parameter part size is not N*8: we add padding to GPRs part, so part's last byte must be recovered at address K*8-1. We need to do it, since remained (stack) part of parameter starts from address K*8, and we need to "attach" "GPRs head" without gaps to it: Stack: |---- 8 bytes block ----| |---- 8 bytes block ----| |---- 8 bytes... [ [padding] [GPRs head] ] [ ------ Tail passed via stack ------ ... FIX: Note, once we added padding we need to correct *all* Arg offsets that are going after padded one. That's why we need this fix: Arg offsets were never corrected before this patch. See new test-cases included in patch. We also don't need to insert padding for byval parameters that are stored in GPRs only. We need pad only last byval parameter and only in case it outsides GPRs and stack alignment = 8. Though, stack area, allocated for recovered byval params, must satisfy "Size mod 8 = 0" restriction. This patch reduces stack usage for some cases: We can reduce ArgRegsSaveArea since inner N*4 bytes sized byval params my be "packed" with alignment 4 in some cases. llvm-svn: 182237
32 lines
769 B
LLVM
32 lines
769 B
LLVM
;PR15293: ARM codegen ice - expected larger existing stack allocation
|
|
;RUN: llc -mtriple=arm-linux-gnueabihf < %s | FileCheck %s
|
|
|
|
%struct.S227 = type { [49 x i32], i32 }
|
|
|
|
define void @check227(
|
|
i32 %b,
|
|
%struct.S227* byval nocapture %arg0,
|
|
%struct.S227* %arg1) {
|
|
; b --> R0
|
|
; arg0 --> [R1, R2, R3, SP+0 .. SP+188)
|
|
; arg1 --> SP+188
|
|
|
|
entry:
|
|
|
|
;CHECK: sub sp, sp, #16
|
|
;CHECK: push {r11, lr}
|
|
;CHECK: add r0, sp, #12
|
|
;CHECK: stm r0, {r1, r2, r3}
|
|
;CHECK: ldr r0, [sp, #212]
|
|
;CHECK: bl useInt
|
|
;CHECK: pop {r11, lr}
|
|
;CHECK: add sp, sp, #16
|
|
|
|
%0 = ptrtoint %struct.S227* %arg1 to i32
|
|
tail call void @useInt(i32 %0)
|
|
ret void
|
|
}
|
|
|
|
declare void @useInt(i32)
|
|
|