diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp --- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -96,19 +96,20 @@ /// A helper routine of InstCombiner::visitMul(). /// -/// If C is a scalar/vector of known powers of 2, then this function returns -/// a new scalar/vector obtained from logBase2 of C. +/// If C is a scalar/fixed width vector of known powers of 2, then this +/// function returns a new scalar/fixed width vector obtained from logBase2 +/// of C. /// Return a null pointer otherwise. static Constant *getLogBase2(Type *Ty, Constant *C) { const APInt *IVal; if (match(C, m_APInt(IVal)) && IVal->isPowerOf2()) return ConstantInt::get(Ty, IVal->logBase2()); - if (!Ty->isVectorTy()) + if (!isa(Ty)) return nullptr; SmallVector Elts; - for (unsigned I = 0, E = cast(Ty)->getNumElements(); I != E; + for (unsigned I = 0, E = cast(Ty)->getNumElements(); I != E; ++I) { Constant *Elt = C->getAggregateElement(I); if (!Elt)