diff --git a/llvm/include/llvm/IR/DataLayout.h b/llvm/include/llvm/IR/DataLayout.h --- a/llvm/include/llvm/IR/DataLayout.h +++ b/llvm/include/llvm/IR/DataLayout.h @@ -373,7 +373,7 @@ /// the backends/clients are updated. Align getPointerPrefAlignment(unsigned AS = 0) const; - /// Layout pointer size in bytes, rounded up to a whole + /// Layout pointer size in bytes, rounded up to a power of 2 /// number of bytes. /// FIXME: The defaults need to be removed once all of /// the backends/clients are updated. diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp --- a/llvm/lib/IR/DataLayout.cpp +++ b/llvm/lib/IR/DataLayout.cpp @@ -706,7 +706,7 @@ } unsigned DataLayout::getPointerSize(unsigned AS) const { - return divideCeil(getPointerAlignElem(AS).TypeBitWidth, 8); + return PowerOf2Ceil(divideCeil(getPointerAlignElem(AS).TypeBitWidth, 8)); } unsigned DataLayout::getMaxIndexSize() const {