diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h --- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h +++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h @@ -51,6 +51,16 @@ bool shouldExpandReduction(const IntrinsicInst *II) const; bool supportsScalableVectors() const { return ST->hasStdExtV(); } Optional getMaxVScale() const; + + unsigned getRegisterBitWidth(bool Vector) const { + if (Vector) { + if (ST->hasStdExtV()) + return std::max(ST->getMinRVVVectorSizeInBits(), 128u); + return 0; + } + return ST->getXLen(); + } + }; } // end namespace llvm