summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll
diff options
context:
space:
mode:
authorStepan Dyatkovskiy <stpworld@narod.ru>2012-10-16 07:16:47 +0000
committerStepan Dyatkovskiy <stpworld@narod.ru>2012-10-16 07:16:47 +0000
commite59a920b0c41c1e7e36a5c8d9d609aad87e4ec1e (patch)
treef52f03817031469ab820fb0756a3eb1d83e0a587 /llvm/test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll
parent1705a999fad9de3d1b0368fa9793ae3b3db44015 (diff)
downloadbcm5719-llvm-e59a920b0c41c1e7e36a5c8d9d609aad87e4ec1e.tar.gz
bcm5719-llvm-e59a920b0c41c1e7e36a5c8d9d609aad87e4ec1e.zip
Issue:
Stack is formed improperly for long structures passed as byval arguments for EABI mode. If we took AAPCS reference, we can found the next statements: A: "If the argument requires double-word alignment (8-byte), the NCRN (Next Core Register Number) is rounded up to the next even register number." (5.5 Parameter Passing, Stage C, C.3). B: "The alignment of an aggregate shall be the alignment of its most-aligned component." (4.3 Composite Types, 4.3.1 Aggregates). So if we have structure with doubles (9 double fields) and 3 Core unused registers (r1, r2, r3): caller should use r2 and r3 registers only. Currently r1,r2,r3 set is used, but it is invalid. Callee VA routine should also use r2 and r3 regs only. All is ok here. This behaviour is guessed by rounding up SP address with ADD+BFC operations. Fix: Main fix is in ARMTargetLowering::HandleByVal. If we detected AAPCS mode and 8 byte alignment, we waste odd registers then. P.S.: I also improved LDRB_POST_IMM regression test. Since ldrb instruction will not generated by current regression test after this patch. llvm-svn: 166018
Diffstat (limited to 'llvm/test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll')
-rw-r--r--llvm/test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll17
1 files changed, 5 insertions, 12 deletions
diff --git a/llvm/test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll b/llvm/test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll
index 6eb8fcb2db9..f2395107d42 100644
--- a/llvm/test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll
+++ b/llvm/test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll
@@ -1,23 +1,16 @@
-; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi | FileCheck %s
+; RUN: llc < %s -mtriple=armv7-none-linux- | FileCheck %s
; Check that LDRB_POST_IMM instruction emitted properly.
-%my_struct_t = type { double, double, double }
-@main.val = private unnamed_addr constant %my_struct_t { double 1.0, double 2.0, double 3.0 }, align 8
-
-declare void @f(i32 %n1, %my_struct_t* byval %val);
+%my_struct_t = type { i8, i8, i8, i8, i8 }
+@main.val = private unnamed_addr constant %my_struct_t { i8 1, i8 2, i8 3, i8 4, i8 5 }
+declare void @f(i32 %n1, i32 %n2, i32 %n3, %my_struct_t* byval %val);
; CHECK: main:
define i32 @main() nounwind {
entry:
- %val = alloca %my_struct_t, align 8
- %0 = bitcast %my_struct_t* %val to i8*
-
; CHECK: ldrb {{(r[0-9]+)}}, {{(\[r[0-9]+\])}}, #1
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* bitcast (%my_struct_t* @main.val to i8*), i32 24, i32 8, i1 false)
-
- call void @f(i32 555, %my_struct_t* byval %val)
+ call void @f(i32 555, i32 555, i32 555, %my_struct_t* byval @main.val)
ret i32 0
}
-declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
OpenPOWER on IntegriCloud