diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h --- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -634,7 +634,8 @@ // The max required size is the total vector width divided by num // of elements in the vector - unsigned MaxRequiredSize = VT->getBitWidth() / VT->getNumElements(); + unsigned MaxRequiredSize = + VT->getElementType()->getPrimitiveSizeInBits().getFixedSize(); unsigned MinRequiredSize = 0; for (unsigned i = 0, e = VT->getNumElements(); i < e; ++i) {