aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-04-21 23:32:43 +0000
committerDan Gohman <gohman@apple.com>2010-04-21 23:32:43 +0000
commit8eefcd353c1d06a10104f69e5079ebab3183f9a3 (patch)
treedc7ae1332559a5817d45c2ce0d978cc4487425d4 /lib/AST/ASTContext.cpp
parent688fc9b9b4323a294f5bf4f8a83f7c365edec573 (diff)
When computing the alignof value for a vector type, ensure that
the alignment is a power of 2, even in the esoteric case of a vector element which does not have a power-of-2 sizeof value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102036 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r--lib/AST/ASTContext.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 96e2e75eaa..7431a23cdd 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -515,7 +515,7 @@ ASTContext::getTypeInfo(const Type *T) {
Align = Width;
// If the alignment is not a power of 2, round up to the next power of 2.
// This happens for non-power-of-2 length vectors.
- if (VT->getNumElements() & (VT->getNumElements()-1)) {
+ if (Align & (Align-1)) {
Align = llvm::NextPowerOf2(Align);
Width = llvm::RoundUpToAlignment(Width, Align);
}