diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp index 8092b9c96f49b3..5ffbe5d83e4568 100644 --- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp @@ -132,16 +132,8 @@ bool RISCVTTIImpl::shouldExpandReduction(const IntrinsicInst *II) const { } Optional RISCVTTIImpl::getMaxVScale() const { - // There is no assumption of the maximum vector length in V specification. - // We use the value specified by users as the maximum vector length. - // This function will use the assumed maximum vector length to get the - // maximum vscale for LoopVectorizer. - // If users do not specify the maximum vector length, we have no way to - // know whether the LoopVectorizer is safe to do or not. - // We only consider to use single vector register (LMUL = 1) to vectorize. - unsigned MaxVectorSizeInBits = ST->getMaxRVVVectorSizeInBits(); - if (ST->hasVInstructions() && MaxVectorSizeInBits != 0) - return MaxVectorSizeInBits / RISCV::RVVBitsPerBlock; + if (ST->hasVInstructions()) + return ST->getRealMaxVLen() / RISCV::RVVBitsPerBlock; return BaseT::getMaxVScale(); }