[llvm] r194466 - XCore target: fix bug in aligning 'byval i8*' on the stack

Robert Lytton robert at xmos.com
Tue Nov 12 02:11:36 PST 2013


Author: rlytton
Date: Tue Nov 12 04:11:35 2013
New Revision: 194466

URL: http://llvm.org/viewvc/llvm-project?rev=194466&view=rev
Log:
XCore target: fix bug in aligning 'byval i8*' on the stack

Modified:
    llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
    llvm/trunk/test/CodeGen/XCore/byVal.ll

Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=194466&r1=194465&r2=194466&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Tue Nov 12 04:11:35 2013
@@ -1224,7 +1224,7 @@ XCoreTargetLowering::LowerCCCArguments(S
        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);

Modified: llvm/trunk/test/CodeGen/XCore/byVal.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/byVal.ll?rev=194466&r1=194465&r2=194466&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/XCore/byVal.ll (original)
+++ llvm/trunk/test/CodeGen/XCore/byVal.ll Tue Nov 12 04:11:35 2013
@@ -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
+}





More information about the llvm-commits mailing list