diff options
author | Oliver Stannard <oliver.stannard@arm.com> | 2014-07-18 09:09:31 +0000 |
---|---|---|
committer | Oliver Stannard <oliver.stannard@arm.com> | 2014-07-18 09:09:31 +0000 |
commit | e022851f3b253f421eced5fb0f8f5654771a35a1 (patch) | |
tree | de0900534dafd45df27b6ec167df53b453609357 /clang/lib/CodeGen/TargetInfo.cpp | |
parent | 12817862f10b9f3e9da7cd3e3dfc5dad86cd8cb8 (diff) | |
download | bcm5719-llvm-e022851f3b253f421eced5fb0f8f5654771a35a1.tar.gz bcm5719-llvm-e022851f3b253f421eced5fb0f8f5654771a35a1.zip |
[ARM] Fix AAPCS regression caused by r211898
r211898 introduced a regression where a large struct, which would
normally be passed ByVal, was causing padding to be inserted to
prevent the backend from using some GPRs, in order to follow the
AAPCS. However, the type of the argument was not being set correctly,
so the backend cannot align 8-byte aligned struct types on the stack.
The fix is to not insert the padding arguments when the argument is
being passed ByVal.
llvm-svn: 213359
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 10050acad9d..4ccdedbd7f9 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -3996,8 +3996,12 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI) const { // GPRs from being used. In this situation, the current argument could // only be allocated by rule C.8, so rule C.6 would mark these GPRs as // unusable anyway. + // We do not have to do this if the argument is being passed ByVal, as the + // backend can handle that situation correctly. const bool StackUsed = PreAllocationGPRs > NumGPRs || PreAllocationVFPs > NumVFPs; - if (!IsCPRC && PreAllocationGPRs < NumGPRs && AllocatedGPRs > NumGPRs && StackUsed) { + const bool IsByVal = I.info.isIndirect() && I.info.getIndirectByVal(); + if (!IsCPRC && PreAllocationGPRs < NumGPRs && AllocatedGPRs > NumGPRs && + StackUsed && !IsByVal) { llvm::Type *PaddingTy = llvm::ArrayType::get( llvm::Type::getInt32Ty(getVMContext()), NumGPRs - PreAllocationGPRs); if (I.info.canHaveCoerceToType()) { |