summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-02-18 22:28:45 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-02-18 22:28:45 +0000
commit8cdb9dae45e944060012a0176f2cea952ee36881 (patch)
tree493da1a7efb08fcfaf4822292754016f1b9cecad /clang/lib/CodeGen
parentfaca7d9842f05e0c1246e4400547334355836ea6 (diff)
downloadbcm5719-llvm-8cdb9dae45e944060012a0176f2cea952ee36881.tar.gz
bcm5719-llvm-8cdb9dae45e944060012a0176f2cea952ee36881.zip
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). llvm-svn: 64967
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index f012d93bfae..45b386f4261 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud