summaryrefslogtreecommitdiffstats
path: root/clang/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
commitef78c8ebd71a49a074eeb2ef7f5e7397602c9a58 (patch)
tree06e71c658ac4252f93147280f799b71335261aa6 /clang/lib/AST/ASTContext.cpp
parent6b7f12c0396e18f51540c4901bb8ccbc35db1151 (diff)
downloadbcm5719-llvm-ef78c8ebd71a49a074eeb2ef7f5e7397602c9a58.tar.gz
bcm5719-llvm-ef78c8ebd71a49a074eeb2ef7f5e7397602c9a58.zip
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. llvm-svn: 102036
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 96e2e75eaaa..7431a23cdd5 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/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);
}
OpenPOWER on IntegriCloud