diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-07-13 23:57:43 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-07-13 23:57:43 +0000 |
commit | f9e9af7df0cea6e997ac04131c7af6ca4384b0cc (patch) | |
tree | e465c3d01b6954e3ae02b85003f2e1135a0fd47e /lib/AST/ASTContext.cpp | |
parent | 558e8872b364b43ab9f201dd6b2df9a5b74b0542 (diff) |
Add a per target max vector alignment field (e.g., 32-byte alignment for x86 due to
AVX). Currently, if no aligned attribute is specified the alignment of a vector is
inferred from its size. Thus, very large vectors will be over-aligned with no
benefit. Target owners should set this target max.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160209 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index a9681d8669..b0351d69ad 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1047,6 +1047,10 @@ ASTContext::getTypeInfoImpl(const Type *T) const { Align = llvm::NextPowerOf2(Align); Width = llvm::RoundUpToAlignment(Width, Align); } + // Adjust the alignment based on the target max. + uint64_t TargetVectorAlign = Target->getMaxVectorAlign(); + if (TargetVectorAlign && TargetVectorAlign < Align) + Align = TargetVectorAlign; break; } |