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
This commit is contained in:
Dan Gohman 2010-04-21 23:32:43 +00:00
parent 6b7f12c039
commit ef78c8ebd7
1 changed files with 1 additions and 1 deletions

View File

@ -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);
}