diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h index 22d14e27b1de89..775d90bf5347e3 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 d18779ffd7c6f4..4b43ee445e8dcb 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 c21e0d280d6d13..d4c4aa2bec50b8 100644 --- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h @@ -264,8 +264,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase { 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 34419185027944..60b127b25e04ca 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 1b192fd5f35160..479fc4742fee2c 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 63f23bce1d8c46..8c08ad2795d994 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h +++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h @@ -75,7 +75,7 @@ class PPCTTIImpl : public BasicTTIImplBase { 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 6ef49839955907..2713fa61ba31ea 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) {