diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-02-18 22:28:45 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-02-18 22:28:45 +0000 |
commit | 570f0cf734f321b902eb18dd1b07f53543f0a393 (patch) | |
tree | c2158c61f95735f6237978c84c99439d3527953a /lib/CodeGen/CGCall.cpp | |
parent | 022468050257764d9039dff526d3b0736320b5de (diff) |
i386 ABI: Offset computation in va_arg was incorrect for sizeof(Ty)>4.
We are down to only failing gcc.dg/compat/vector-[12] (8 tests total).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64967 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r-- | lib/CodeGen/CGCall.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index f012d93bfa..45b386f426 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -360,14 +360,11 @@ llvm::Value *X86_32ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty, llvm::PointerType::getUnqual(CGF.ConvertType(Ty)); llvm::Value *AddrTyped = Builder.CreateBitCast(Addr, PTy); - uint64_t SizeInBytes = CGF.getContext().getTypeSize(Ty) / 8; - const unsigned ArgumentSizeInBytes = 4; - if (SizeInBytes < ArgumentSizeInBytes) - SizeInBytes = ArgumentSizeInBytes; - + uint64_t Offset = + llvm::RoundUpToAlignment(CGF.getContext().getTypeSize(Ty) / 8, 4); llvm::Value *NextAddr = Builder.CreateGEP(Addr, - llvm::ConstantInt::get(llvm::Type::Int32Ty, SizeInBytes), + llvm::ConstantInt::get(llvm::Type::Int32Ty, Offset), "ap.next"); Builder.CreateStore(NextAddr, VAListAddrAsBPP); |