[llvm] 00e573c - [LSR] fix typo in comments and rename for a new added hook.

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 26 19:29:58 PDT 2020


Author: Chen Zheng
Date: 2020-10-26T22:29:22-04:00
New Revision: 00e573cadb2791804fd0859d0ee05b27b702e11e

URL: https://github.com/llvm/llvm-project/commit/00e573cadb2791804fd0859d0ee05b27b702e11e
DIFF: https://github.com/llvm/llvm-project/commit/00e573cadb2791804fd0859d0ee05b27b702e11e.diff

LOG: [LSR] fix typo in comments and rename for a new added hook.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/TargetTransformInfo.h
    llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
    llvm/include/llvm/CodeGen/BasicTTIImpl.h
    llvm/lib/Analysis/TargetTransformInfo.cpp
    llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
    llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
    llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index 22d14e27b1de..775d90bf5347 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -613,10 +613,10 @@ class TargetTransformInfo {
   bool isLSRCostLess(TargetTransformInfo::LSRCost &C1,
                      TargetTransformInfo::LSRCost &C2) const;
 
-  /// Return true if LSR major cost is register number. Targets which implement
-  /// their own isLSRCostLess and unset register number as major cost should
-  /// return false, otherwise return true.
-  bool isRegNumMajorCostOfLSR() const;
+  /// Return true if LSR major cost is number of registers. Targets which
+  /// implement their own isLSRCostLess and unset number of registers as major
+  /// cost should return false, otherwise return true.
+  bool isNumRegsMajorCostOfLSR() const;
 
   /// \returns true if LSR should not optimize a chain that includes \p I.
   bool isProfitableLSRChainElement(Instruction *I) const;
@@ -1415,7 +1415,7 @@ class TargetTransformInfo::Concept {
                                      Instruction *I) = 0;
   virtual bool isLSRCostLess(TargetTransformInfo::LSRCost &C1,
                              TargetTransformInfo::LSRCost &C2) = 0;
-  virtual bool isRegNumMajorCostOfLSR() = 0;
+  virtual bool isNumRegsMajorCostOfLSR() = 0;
   virtual bool isProfitableLSRChainElement(Instruction *I) = 0;
   virtual bool canMacroFuseCmp() = 0;
   virtual bool canSaveCmp(Loop *L, BranchInst **BI, ScalarEvolution *SE,
@@ -1737,8 +1737,8 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
                      TargetTransformInfo::LSRCost &C2) override {
     return Impl.isLSRCostLess(C1, C2);
   }
-  bool isRegNumMajorCostOfLSR() override {
-    return Impl.isRegNumMajorCostOfLSR();
+  bool isNumRegsMajorCostOfLSR() override {
+    return Impl.isNumRegsMajorCostOfLSR();
   }
   bool isProfitableLSRChainElement(Instruction *I) override {
     return Impl.isProfitableLSRChainElement(I);

diff  --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index d18779ffd7c6..4b43ee445e8d 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -192,7 +192,7 @@ class TargetTransformInfoImplBase {
                     C2.ScaleCost, C2.ImmCost, C2.SetupCost);
   }
 
-  bool isRegNumMajorCostOfLSR() { return true; }
+  bool isNumRegsMajorCostOfLSR() { return true; }
 
   bool isProfitableLSRChainElement(Instruction *I) { return false; }
 

diff  --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index c21e0d280d6d..d4c4aa2bec50 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -264,8 +264,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
     return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
   }
 
-  bool isRegNumMajorCostOfLSR() {
-    return TargetTransformInfoImplBase::isRegNumMajorCostOfLSR();
+  bool isNumRegsMajorCostOfLSR() {
+    return TargetTransformInfoImplBase::isNumRegsMajorCostOfLSR();
   }
 
   bool isProfitableLSRChainElement(Instruction *I) {

diff  --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index 344191850279..60b127b25e04 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -377,8 +377,8 @@ bool TargetTransformInfo::isLSRCostLess(LSRCost &C1, LSRCost &C2) const {
   return TTIImpl->isLSRCostLess(C1, C2);
 }
 
-bool TargetTransformInfo::isRegNumMajorCostOfLSR() const {
-  return TTIImpl->isRegNumMajorCostOfLSR();
+bool TargetTransformInfo::isNumRegsMajorCostOfLSR() const {
+  return TTIImpl->isNumRegsMajorCostOfLSR();
 }
 
 bool TargetTransformInfo::isProfitableLSRChainElement(Instruction *I) const {

diff  --git a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
index 1b192fd5f351..479fc4742fee 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
@@ -1204,7 +1204,7 @@ bool PPCTTIImpl::isLSRCostLess(TargetTransformInfo::LSRCost &C1,
     return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
 }
 
-bool PPCTTIImpl::isRegNumMajorCostOfLSR() {
+bool PPCTTIImpl::isNumRegsMajorCostOfLSR() {
   return false;
 }
 

diff  --git a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
index 63f23bce1d8c..8c08ad2795d9 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
+++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
@@ -75,7 +75,7 @@ class PPCTTIImpl : public BasicTTIImplBase<PPCTTIImpl> {
                              TTI::PeelingPreferences &PP);
   bool isLSRCostLess(TargetTransformInfo::LSRCost &C1,
                      TargetTransformInfo::LSRCost &C2);
-  bool isRegNumMajorCostOfLSR();
+  bool isNumRegsMajorCostOfLSR();
 
   /// @}
 

diff  --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 6ef498399559..2713fa61ba31 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -2866,11 +2866,11 @@ static bool isProfitableChain(IVChain &Chain,
     if (TTI.isProfitableLSRChainElement(Inc.UserInst))
       return true;
 
-  // If register number is the major cost, we cannot benefit from this
-  // profitable chain which is based on register number.
+  // If number of registers is not the major cost, we cannot benefit from this
+  // profitable chain which is based on number of registers.
   // FIXME: add profitable chain optimization for other kinds major cost, for
-  // example instruction number.
-  if (!TTI.isRegNumMajorCostOfLSR())
+  // example number of instructions.
+  if (!TTI.isNumRegsMajorCostOfLSR())
     return false;
 
   for (const IVInc &Inc : Chain) {


        


More information about the llvm-commits mailing list