summaryrefslogtreecommitdiff
path: root/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2014-04-18 10:47:44 +0000
committerTim Northover <tnorthover@apple.com>2014-04-18 10:47:44 +0000
commitdb2467f5dbd078f964d769d27625fd653daaf08e (patch)
tree8766828b57a17644df4f315b0b2d162ff63389d7 /lib/CodeGen/TargetInfo.cpp
parentb56be34317460c462f3c9b9b84d0286ca784506b (diff)
downloadclang-db2467f5dbd078f964d769d27625fd653daaf08e.tar.gz
clang-db2467f5dbd078f964d769d27625fd653daaf08e.tar.bz2
clang-db2467f5dbd078f964d769d27625fd653daaf08e.tar.xz
ARM64: make sure HFAs on the stack get properly aligned.
Another AAPCS bug, part of PR19432. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206580 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TargetInfo.cpp')
-rw-r--r--lib/CodeGen/TargetInfo.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index e9bb3cdb08..47c5269ec5 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -3187,13 +3187,14 @@ private:
// Under AAPCS the 64-bit stack slot alignment means we can't pass HAs
// as sequences of floats since they'll get "holes" inserted as
// padding by the back end.
- if (IsHA && AllocatedVFP > NumVFPs && !isDarwinPCS()) {
- uint32_t NumStackSlots = getContext().getTypeSize(it->type);
- NumStackSlots = llvm::RoundUpToAlignment(NumStackSlots, 64) / 64;
-
- llvm::Type *CoerceTy = llvm::ArrayType::get(
- llvm::Type::getDoubleTy(getVMContext()), NumStackSlots);
- it->info = ABIArgInfo::getDirect(CoerceTy);
+ if (IsHA && AllocatedVFP > NumVFPs && !isDarwinPCS() &&
+ getContext().getTypeAlign(it->type) < 64) {
+ uint32_t NumStackSlots = getContext().getTypeSize(it->type);
+ NumStackSlots = llvm::RoundUpToAlignment(NumStackSlots, 64) / 64;
+
+ llvm::Type *CoerceTy = llvm::ArrayType::get(
+ llvm::Type::getDoubleTy(getVMContext()), NumStackSlots);
+ it->info = ABIArgInfo::getDirect(CoerceTy);
}
// If we do not have enough VFP registers for the HA, any VFP registers