diff options
author | Manman Ren <mren@apple.com> | 2012-10-16 19:51:48 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2012-10-16 19:51:48 +0000 |
commit | 67effb97df7fe4d951c7caba8aa6a840f5fde9c4 (patch) | |
tree | 1e9c3296a147b842fb82ae270a80ce1600edeff1 /clang/lib/CodeGen | |
parent | d6f3168a08fabc3c2ef2451fdf3518dbf2da88ca (diff) | |
download | bcm5719-llvm-67effb97df7fe4d951c7caba8aa6a840f5fde9c4.tar.gz bcm5719-llvm-67effb97df7fe4d951c7caba8aa6a840f5fde9c4.zip |
ARM ABI: fix ABI alignment issues in varargs.
We generalize r166040 to handle ABI alignment issues for all types.
rdar://12439123
llvm-svn: 166052
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 24be05fb859..4ee9b97843d 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -3213,13 +3213,11 @@ llvm::Value *ARMABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty, // The ABI alignment for 64-bit or 128-bit vectors is 8 for AAPCS and 4 for // APCS. For AAPCS, the ABI alignment is at least 4-byte and at most 8-byte. - if (Ty->getAs<VectorType>()) { - if (getABIKind() == ARMABIInfo::AAPCS_VFP || - getABIKind() == ARMABIInfo::AAPCS) - TyAlign = std::min(std::max(TyAlign, (uint64_t)4), (uint64_t)8); - else - TyAlign = 4; - } + if (getABIKind() == ARMABIInfo::AAPCS_VFP || + getABIKind() == ARMABIInfo::AAPCS) + TyAlign = std::min(std::max(TyAlign, (uint64_t)4), (uint64_t)8); + else + TyAlign = 4; // Use indirect if size of the illegal vector is bigger than 16 bytes. if (isIllegalVectorType(Ty) && Size > 16) { IsIndirect = true; @@ -3246,8 +3244,7 @@ llvm::Value *ARMABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty, if (IsIndirect) Addr = Builder.CreateLoad(Builder.CreateBitCast(Addr, BPP)); - else if (Ty->getAs<VectorType>() && - (TyAlign < CGF.getContext().getTypeAlign(Ty) / 8)) { + else if (TyAlign < CGF.getContext().getTypeAlign(Ty) / 8) { // We can't directly cast ap.cur to pointer to a vector type, since ap.cur // may not be correctly aligned for the vector type. We create an aligned // temporary space and copy the content over from ap.cur to the temporary |