diff options
author | James Molloy <james.molloy@arm.com> | 2014-05-07 14:45:55 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2014-05-07 14:45:55 +0000 |
commit | 467be60748f0b8da8fc979c42bb860b77f28a541 (patch) | |
tree | 16d35019fdfb6520b4930be07dd704b02b82ec10 /clang/lib/CodeGen | |
parent | 6d58e0726dd460be633952cf557f29706133db6a (diff) | |
download | bcm5719-llvm-467be60748f0b8da8fc979c42bb860b77f28a541.tar.gz bcm5719-llvm-467be60748f0b8da8fc979c42bb860b77f28a541.zip |
[ARM64-BE] Correctly deal with single element HFAs in varargs.
Just because the first "if" didn't fire, doesn't mean we can not have
an HFA in the "else" clause.
llvm-svn: 208216
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 300fb19f209..fefa8643921 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -3550,7 +3550,8 @@ static llvm::Value *EmitAArch64VAArg(llvm::Value *VAListAddr, QualType Ty, const Type *Base = 0; uint64_t NumMembers; - if (isHomogeneousAggregate(Ty, Base, Ctx, &NumMembers) && NumMembers > 1) { + bool IsHFA = isHomogeneousAggregate(Ty, Base, Ctx, &NumMembers); + if (IsHFA && NumMembers > 1) { // Homogeneous aggregates passed in registers will have their elements split // and stored 16-bytes apart regardless of size (they're notionally in qN, // qN+1, ...). We reload and store into a temporary local variable @@ -3579,7 +3580,8 @@ static llvm::Value *EmitAArch64VAArg(llvm::Value *VAListAddr, QualType Ty, } else { // Otherwise the object is contiguous in memory unsigned BeAlign = reg_top_index == 2 ? 16 : 8; - if (CGF.CGM.getDataLayout().isBigEndian() && !isAggregateTypeForABI(Ty) && + if (CGF.CGM.getDataLayout().isBigEndian() && + (IsHFA || !isAggregateTypeForABI(Ty)) && Ctx.getTypeSize(Ty) < (BeAlign * 8)) { int Offset = BeAlign - Ctx.getTypeSize(Ty) / 8; BaseAddr = CGF.Builder.CreatePtrToInt(BaseAddr, CGF.Int64Ty); |