[TTI] NFC: Change getCostOfKeepingLiveOverCall 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

Reviewed By: sdesmalen

Differential Revision: https://reviews.llvm.org/D102831
This commit is contained in:
Daniil Fukalov 2021-05-20 12:09:16 +03:00
parent e8e88c3353
commit e1cb98be2d
5 changed files with 10 additions and 8 deletions

View File

@ -1239,7 +1239,7 @@ public:
/// ///
/// Some types may require the use of register classes that do not have /// Some types may require the use of register classes that do not have
/// any callee-saved registers, so would require a spill and fill. /// any callee-saved registers, so would require a spill and fill.
unsigned getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) const; InstructionCost getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) const;
/// \returns True if the intrinsic is a supported memory intrinsic. Info /// \returns True if the intrinsic is a supported memory intrinsic. Info
/// will contain additional information - whether the intrinsic may write /// will contain additional information - whether the intrinsic may write
@ -1673,7 +1673,8 @@ public:
virtual unsigned getNumberOfParts(Type *Tp) = 0; virtual unsigned getNumberOfParts(Type *Tp) = 0;
virtual InstructionCost virtual InstructionCost
getAddressComputationCost(Type *Ty, ScalarEvolution *SE, const SCEV *Ptr) = 0; getAddressComputationCost(Type *Ty, ScalarEvolution *SE, const SCEV *Ptr) = 0;
virtual unsigned getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) = 0; virtual InstructionCost
getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) = 0;
virtual bool getTgtMemIntrinsic(IntrinsicInst *Inst, virtual bool getTgtMemIntrinsic(IntrinsicInst *Inst,
MemIntrinsicInfo &Info) = 0; MemIntrinsicInfo &Info) = 0;
virtual unsigned getAtomicMemIntrinsicMaxElementSize() const = 0; virtual unsigned getAtomicMemIntrinsicMaxElementSize() const = 0;
@ -2190,7 +2191,7 @@ public:
const SCEV *Ptr) override { const SCEV *Ptr) override {
return Impl.getAddressComputationCost(Ty, SE, Ptr); return Impl.getAddressComputationCost(Ty, SE, Ptr);
} }
unsigned getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) override { InstructionCost getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) override {
return Impl.getCostOfKeepingLiveOverCall(Tys); return Impl.getCostOfKeepingLiveOverCall(Tys);
} }
bool getTgtMemIntrinsic(IntrinsicInst *Inst, bool getTgtMemIntrinsic(IntrinsicInst *Inst,

View File

@ -636,7 +636,7 @@ public:
return 1; return 1;
} }
unsigned getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) const { InstructionCost getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) const {
return 0; return 0;
} }

View File

@ -917,7 +917,7 @@ InstructionCost TargetTransformInfo::getExtendedAddReductionCost(
CostKind); CostKind);
} }
unsigned InstructionCost
TargetTransformInfo::getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) const { TargetTransformInfo::getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) const {
return TTIImpl->getCostOfKeepingLiveOverCall(Tys); return TTIImpl->getCostOfKeepingLiveOverCall(Tys);
} }

View File

@ -1286,7 +1286,8 @@ InstructionCost AArch64TTIImpl::getInterleavedMemoryOpCost(
UseMaskForCond, UseMaskForGaps); UseMaskForCond, UseMaskForGaps);
} }
int AArch64TTIImpl::getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) { InstructionCost
AArch64TTIImpl::getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) {
InstructionCost Cost = 0; InstructionCost Cost = 0;
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput; TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
for (auto *I : Tys) { for (auto *I : Tys) {
@ -1297,7 +1298,7 @@ int AArch64TTIImpl::getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) {
Cost += getMemoryOpCost(Instruction::Store, I, Align(128), 0, CostKind) + Cost += getMemoryOpCost(Instruction::Store, I, Align(128), 0, CostKind) +
getMemoryOpCost(Instruction::Load, I, Align(128), 0, CostKind); getMemoryOpCost(Instruction::Load, I, Align(128), 0, CostKind);
} }
return *Cost.getValue(); return Cost;
} }
unsigned AArch64TTIImpl::getMaxInterleaveFactor(unsigned VF) { unsigned AArch64TTIImpl::getMaxInterleaveFactor(unsigned VF) {

View File

@ -193,7 +193,7 @@ public:
TTI::TargetCostKind CostKind, TTI::TargetCostKind CostKind,
const Instruction *I = nullptr); const Instruction *I = nullptr);
int getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys); InstructionCost getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys);
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
TTI::UnrollingPreferences &UP); TTI::UnrollingPreferences &UP);