[llvm] 2cb357d - [RISCV][TTI] Constify a few routines [nfc]

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 11:04:15 PDT 2023


Author: Philip Reames
Date: 2023-09-07T11:03:52-07:00
New Revision: 2cb357d01a8026da162cdd8b9106fc5eb6263d7b

URL: https://github.com/llvm/llvm-project/commit/2cb357d01a8026da162cdd8b9106fc5eb6263d7b
DIFF: https://github.com/llvm/llvm-project/commit/2cb357d01a8026da162cdd8b9106fc5eb6263d7b.diff

LOG: [RISCV][TTI] Constify a few routines [nfc]

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
    llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 7cf8c7001e511ae..1c565111d64b3fa 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -34,7 +34,7 @@ static cl::opt<unsigned> SLPMaxVF(
         "exclusively by SLP vectorizer."),
     cl::Hidden);
 
-InstructionCost RISCVTTIImpl::getLMULCost(MVT VT) {
+InstructionCost RISCVTTIImpl::getLMULCost(MVT VT) const {
   // TODO: Here assume reciprocal throughput is 1 for LMUL_1, it is
   // implementation-defined.
   if (!VT.isVector())
@@ -266,14 +266,14 @@ static VectorType *getVRGatherIndexType(MVT DataVT, const RISCVSubtarget &ST,
 /// Return the cost of a vrgather.vv instruction for the type VT.  vrgather.vv
 /// is generally quadratic in the number of vreg implied by LMUL.  Note that
 /// operand (index and possibly mask) are handled separately.
-InstructionCost RISCVTTIImpl::getVRGatherVVCost(MVT VT) {
+InstructionCost RISCVTTIImpl::getVRGatherVVCost(MVT VT) const {
   return getLMULCost(VT) * getLMULCost(VT);
 }
 
 /// Return the cost of a vrgather.vi (or vx) instruction for the type VT.
 /// vrgather.vi/vx may be linear in the number of vregs implied by LMUL,
 /// or may track the vrgather.vv cost. It is implementation-dependent.
-InstructionCost RISCVTTIImpl::getVRGatherVICost(MVT VT) {
+InstructionCost RISCVTTIImpl::getVRGatherVICost(MVT VT) const {
   return getLMULCost(VT);
 }
 
@@ -281,7 +281,7 @@ InstructionCost RISCVTTIImpl::getVRGatherVICost(MVT VT) {
 /// for the type VT.  (This does not cover the vslide1up or vslide1down
 /// variants.)  Slides may be linear in the number of vregs implied by LMUL,
 /// or may track the vrgather.vv cost. It is implementation-dependent.
-InstructionCost RISCVTTIImpl::getVSlideCost(MVT VT) {
+InstructionCost RISCVTTIImpl::getVSlideCost(MVT VT) const {
   return getLMULCost(VT);
 }
 

diff  --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
index 8e86940d03a02db..cfa1c504be95636 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
@@ -49,7 +49,7 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
   unsigned getEstimatedVLFor(VectorType *Ty);
 
   /// Return the cost of LMUL. The larger the LMUL, the higher the cost.
-  InstructionCost getLMULCost(MVT VT);
+  InstructionCost getLMULCost(MVT VT) const;
 
   /// Return the cost of accessing a constant pool entry of the specified
   /// type.
@@ -123,9 +123,9 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
     return ST->useRVVForFixedLengthVectors() ? 16 : 0;
   }
 
-  InstructionCost getVRGatherVVCost(MVT VT);
-  InstructionCost getVRGatherVICost(MVT VT);
-  InstructionCost getVSlideCost(MVT VT);
+  InstructionCost getVRGatherVVCost(MVT VT) const;
+  InstructionCost getVRGatherVICost(MVT VT) const;
+  InstructionCost getVSlideCost(MVT VT) const;
 
   InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp,
                                  ArrayRef<int> Mask,


        


More information about the llvm-commits mailing list