summaryrefslogtreecommitdiff
path: root/test/CodeGen/ARM/2013-05-13-AAPCS-byval-padding2.ll
diff options
context:
space:
mode:
authorStepan Dyatkovskiy <stpworld@narod.ru>2013-05-20 08:01:34 +0000
committerStepan Dyatkovskiy <stpworld@narod.ru>2013-05-20 08:01:34 +0000
commit083bc97344d618884ef04bc1ba1fc4ddf14d867d (patch)
treeb108c3d768a319d6649d9e28cbb7f51f38420f05 /test/CodeGen/ARM/2013-05-13-AAPCS-byval-padding2.ll
parent3a408fa8789b902f6fb1d8f256f9d00dd27e9619 (diff)
downloadllvm-083bc97344d618884ef04bc1ba1fc4ddf14d867d.tar.gz
llvm-083bc97344d618884ef04bc1ba1fc4ddf14d867d.tar.bz2
llvm-083bc97344d618884ef04bc1ba1fc4ddf14d867d.tar.xz
PR15868 fix.
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182237 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ARM/2013-05-13-AAPCS-byval-padding2.ll')
-rw-r--r--test/CodeGen/ARM/2013-05-13-AAPCS-byval-padding2.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/CodeGen/ARM/2013-05-13-AAPCS-byval-padding2.ll b/test/CodeGen/ARM/2013-05-13-AAPCS-byval-padding2.ll
new file mode 100644
index 0000000000..438b021a04
--- /dev/null
+++ b/test/CodeGen/ARM/2013-05-13-AAPCS-byval-padding2.ll
@@ -0,0 +1,25 @@
+;PR15293: ARM codegen ice - expected larger existing stack allocation
+;RUN: llc -mtriple=arm-linux-gnueabihf < %s | FileCheck %s
+
+%struct4bytes = type { i32 }
+%struct20bytes = type { i32, i32, i32, i32, i32 }
+
+define void @foo(%struct4bytes* byval %p0, ; --> R0
+ %struct20bytes* byval %p1 ; --> R1,R2,R3, [SP+0 .. SP+8)
+) {
+;CHECK: sub sp, sp, #16
+;CHECK: push {r11, lr}
+;CHECK: add r11, sp, #8
+;CHECK: stm r11, {r0, r1, r2, r3}
+;CHECK: add r0, sp, #12
+;CHECK: bl useInt
+;CHECK: pop {r11, lr}
+;CHECK: add sp, sp, #16
+
+ %1 = ptrtoint %struct20bytes* %p1 to i32
+ tail call void @useInt(i32 %1)
+ ret void
+}
+
+declare void @useInt(i32)
+