[cfe-commits] r102036 - /cfe/trunk/lib/AST/ASTContext.cpp
Dan Gohman
gohman at apple.com
Wed Apr 21 16:32:43 PDT 2010
Author: djg
Date: Wed Apr 21 18:32:43 2010
New Revision: 102036
URL: http://llvm.org/viewvc/llvm-project?rev=102036&view=rev
Log:
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.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=102036&r1=102035&r2=102036&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Apr 21 18:32:43 2010
@@ -515,7 +515,7 @@
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);
}
More information about the cfe-commits
mailing list