Skip to content

Commit 008a072

Browse files
committed
[TTI] NFC: Change getMemcpyCost to return InstructionCost
This patch migrates the TTI cost interfaces to return an InstructionCost. See this patch for the introduction of the type: https://reviews.llvm.org/D91174 See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html Differential Revision: https://reviews.llvm.org/D100563
1 parent 9ba07f3 commit 008a072

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

llvm/include/llvm/Analysis/TargetTransformInfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ class TargetTransformInfo {
293293

294294
/// \return the expected cost of a memcpy, which could e.g. depend on the
295295
/// source/destination type and alignment and the number of bytes copied.
296-
int getMemcpyCost(const Instruction *I) const;
296+
InstructionCost getMemcpyCost(const Instruction *I) const;
297297

298298
/// \return The estimated number of case clusters when lowering \p 'SI'.
299299
/// \p JTSize Set a jump table size only when \p SI is suitable for a jump
@@ -1408,7 +1408,7 @@ class TargetTransformInfo::Concept {
14081408
virtual unsigned getInliningThresholdMultiplier() = 0;
14091409
virtual unsigned adjustInliningThreshold(const CallBase *CB) = 0;
14101410
virtual int getInlinerVectorBonusPercent() = 0;
1411-
virtual int getMemcpyCost(const Instruction *I) = 0;
1411+
virtual InstructionCost getMemcpyCost(const Instruction *I) = 0;
14121412
virtual unsigned
14131413
getEstimatedNumberOfCaseClusters(const SwitchInst &SI, unsigned &JTSize,
14141414
ProfileSummaryInfo *PSI,
@@ -1709,7 +1709,7 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
17091709
int getInlinerVectorBonusPercent() override {
17101710
return Impl.getInlinerVectorBonusPercent();
17111711
}
1712-
int getMemcpyCost(const Instruction *I) override {
1712+
InstructionCost getMemcpyCost(const Instruction *I) override {
17131713
return Impl.getMemcpyCost(I);
17141714
}
17151715
InstructionCost getUserCost(const User *U, ArrayRef<const Value *> Operands,

llvm/include/llvm/Analysis/TargetTransformInfoImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class TargetTransformInfoImplBase {
7575

7676
int getInlinerVectorBonusPercent() const { return 150; }
7777

78-
unsigned getMemcpyCost(const Instruction *I) const {
78+
InstructionCost getMemcpyCost(const Instruction *I) const {
7979
return TTI::TCC_Expensive;
8080
}
8181

llvm/lib/Analysis/TargetTransformInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -885,8 +885,8 @@ TargetTransformInfo::getAddressComputationCost(Type *Tp, ScalarEvolution *SE,
885885
return Cost;
886886
}
887887

888-
int TargetTransformInfo::getMemcpyCost(const Instruction *I) const {
889-
int Cost = TTIImpl->getMemcpyCost(I);
888+
InstructionCost TargetTransformInfo::getMemcpyCost(const Instruction *I) const {
889+
InstructionCost Cost = TTIImpl->getMemcpyCost(I);
890890
assert(Cost >= 0 && "TTI should not produce negative costs!");
891891
return Cost;
892892
}

llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ int ARMTTIImpl::getNumMemOps(const IntrinsicInst *I) const {
11261126
return -1;
11271127
}
11281128

1129-
int ARMTTIImpl::getMemcpyCost(const Instruction *I) {
1129+
InstructionCost ARMTTIImpl::getMemcpyCost(const Instruction *I) {
11301130
int NumOps = getNumMemOps(cast<IntrinsicInst>(I));
11311131

11321132
// To model the cost of a library call, we assume 1 for the call, and

llvm/lib/Target/ARM/ARMTargetTransformInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class ARMTTIImpl : public BasicTTIImplBase<ARMTTIImpl> {
183183
return isLegalMaskedGather(Ty, Alignment);
184184
}
185185

186-
int getMemcpyCost(const Instruction *I);
186+
InstructionCost getMemcpyCost(const Instruction *I);
187187

188188
int getNumMemOps(const IntrinsicInst *I) const;
189189

0 commit comments

Comments
 (0)