diff options
| author | Robert Lytton <robert@xmos.com> | 2013-11-12 10:11:35 +0000 |
|---|---|---|
| committer | Robert Lytton <robert@xmos.com> | 2013-11-12 10:11:35 +0000 |
| commit | 494591b87fc0b372160f35a88c4f46e0181d8c50 (patch) | |
| tree | af81a0822f24fdfb1be32281522680b488378d90 /llvm | |
| parent | f7f0c5e3267711e7cf907b070d07e1a53e86fdd3 (diff) | |
| download | bcm5719-llvm-494591b87fc0b372160f35a88c4f46e0181d8c50.tar.gz bcm5719-llvm-494591b87fc0b372160f35a88c4f46e0181d8c50.zip | |
XCore target: fix bug in aligning 'byval i8*' on the stack
llvm-svn: 194466
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Target/XCore/XCoreISelLowering.cpp | 2 | ||||
| -rw-r--r-- | llvm/test/CodeGen/XCore/byVal.ll | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/Target/XCore/XCoreISelLowering.cpp b/llvm/lib/Target/XCore/XCoreISelLowering.cpp index 149652ff733..a382a189cf3 100644 --- a/llvm/lib/Target/XCore/XCoreISelLowering.cpp +++ b/llvm/lib/Target/XCore/XCoreISelLowering.cpp @@ -1224,7 +1224,7 @@ XCoreTargetLowering::LowerCCCArguments(SDValue Chain, ArgDI != ArgDE; ++ArgDI) { if (ArgDI->Flags.isByVal() && ArgDI->Flags.getByValSize()) { unsigned Size = ArgDI->Flags.getByValSize(); - unsigned Align = ArgDI->Flags.getByValAlign(); + unsigned Align = std::max(StackSlotSize, ArgDI->Flags.getByValAlign()); // Create a new object on the stack and copy the pointee into it. int FI = MFI->CreateStackObject(Size, Align, false, false); SDValue FIN = DAG.getFrameIndex(FI, MVT::i32); diff --git a/llvm/test/CodeGen/XCore/byVal.ll b/llvm/test/CodeGen/XCore/byVal.ll index a5d25d2d95b..e9612fd6021 100644 --- a/llvm/test/CodeGen/XCore/byVal.ll +++ b/llvm/test/CodeGen/XCore/byVal.ll @@ -56,3 +56,18 @@ entry: call void @f2(i32 %i, %struct.st2* %s2) ret void } + +; CHECK-LABEL: f3Test +; CHECK: entsp 2 +; CHECK: ldc r1, 0 +; CHECK: ld8u r2, r0[r1] +; CHECK: ldaw r0, sp[1] +; CHECK: st8 r2, r0[r1] +; CHECK: bl f +; CHECK: retsp 2 +declare void @f3(i8*) nounwind +define void @f3Test(i8* byval %v) nounwind { +entry: + call void @f3(i8* %v) nounwind + ret void +} |

