From 00e573cadb2791804fd0859d0ee05b27b702e11e Mon Sep 17 00:00:00 2001 From: Chen Zheng Date: Mon, 26 Oct 2020 22:29:22 -0400 Subject: [PATCH] [LSR] fix typo in comments and rename for a new added hook. --- llvm/include/llvm/Analysis/TargetTransformInfo.h | 14 +++++++------- llvm/include/llvm/Analysis/TargetTransformInfoImpl.h | 2 +- llvm/include/llvm/CodeGen/BasicTTIImpl.h | 4 ++-- llvm/lib/Analysis/TargetTransformInfo.cpp | 4 ++-- llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp | 2 +- llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h | 2 +- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 8 ++++---- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h index 22d14e2..775d90b 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfo.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h @@ -613,10 +613,10 @@ public: 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 @@ public: 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 @@ public: 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 d18779f..4b43ee4 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -192,7 +192,7 @@ public: 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 c21e0d2..d4c4aa2 100644 --- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h @@ -264,8 +264,8 @@ public: 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 3441918..60b127b2 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 1b192fd..479fc47 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 63f23bc..8c08ad2 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h +++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h @@ -75,7 +75,7 @@ public: 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 6ef4983..2713fa6 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) { -- 2.7.4