Index: lib/Target/PowerPC/PPCISelLowering.cpp =================================================================== --- lib/Target/PowerPC/PPCISelLowering.cpp +++ lib/Target/PowerPC/PPCISelLowering.cpp @@ -3505,9 +3505,14 @@ // Argument stored in memory. assert(VA.isMemLoc()); + // Get the extended size of the argument type in stack unsigned ArgSize = VA.getLocVT().getStoreSize(); - int FI = MFI.CreateFixedObject(ArgSize, VA.getLocMemOffset(), - isImmutable); + // Get the actual size of the argument type + unsigned ObjSize = VA.getValVT().getStoreSize(); + unsigned ArgOffset = VA.getLocMemOffset(); + // Stack objects in PPC32 are right justified. + ArgOffset += ArgSize - ObjSize; + int FI = MFI.CreateFixedObject(ArgSize, ArgOffset, isImmutable); // Create load nodes to retrieve arguments from the stack. SDValue FIN = DAG.getFrameIndex(FI, PtrVT); @@ -5462,10 +5467,11 @@ Arg = PtrOff; } - if (VA.isRegLoc()) { - if (Arg.getValueType() == MVT::i1) - Arg = DAG.getNode(ISD::ZERO_EXTEND, dl, MVT::i32, Arg); + // Ensure callee will get either 0x00000001 or 0x00000000. + if (Arg.getValueType() == MVT::i1) + Arg = DAG.getNode(ISD::ZERO_EXTEND, dl, MVT::i32, Arg); + if (VA.isRegLoc()) { seenFloatArg |= VA.getLocVT().isFloatingPoint(); // Put argument in a physical register. RegsToPass.push_back(std::make_pair(VA.getLocReg(), Arg));