Skip to content

Commit ef78c8e

Browse files
author
Dan Gohman
committed
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
1 parent 6b7f12c commit ef78c8e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ ASTContext::getTypeInfo(const Type *T) {
515515
Align = Width;
516516
// If the alignment is not a power of 2, round up to the next power of 2.
517517
// This happens for non-power-of-2 length vectors.
518-
if (VT->getNumElements() & (VT->getNumElements()-1)) {
518+
if (Align & (Align-1)) {
519519
Align = llvm::NextPowerOf2(Align);
520520
Width = llvm::RoundUpToAlignment(Width, Align);
521521
}

0 commit comments

Comments
 (0)