[cfe-commits] r64967 - /cfe/trunk/lib/CodeGen/CGCall.cpp
Daniel Dunbar
daniel at zuster.org
Wed Feb 18 14:28:45 PST 2009
Author: ddunbar
Date: Wed Feb 18 16:28:45 2009
New Revision: 64967
URL: http://llvm.org/viewvc/llvm-project?rev=64967&view=rev
Log:
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).
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=64967&r1=64966&r2=64967&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Wed Feb 18 16:28:45 2009
@@ -360,14 +360,11 @@
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);
More information about the cfe-commits
mailing list