diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h --- a/llvm/include/llvm/Analysis/TargetTransformInfo.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h @@ -1239,7 +1239,7 @@ /// /// Some types may require the use of register classes that do not have /// any callee-saved registers, so would require a spill and fill. - unsigned getCostOfKeepingLiveOverCall(ArrayRef Tys) const; + InstructionCost getCostOfKeepingLiveOverCall(ArrayRef Tys) const; /// \returns True if the intrinsic is a supported memory intrinsic. Info /// will contain additional information - whether the intrinsic may write @@ -1673,7 +1673,8 @@ virtual unsigned getNumberOfParts(Type *Tp) = 0; virtual InstructionCost getAddressComputationCost(Type *Ty, ScalarEvolution *SE, const SCEV *Ptr) = 0; - virtual unsigned getCostOfKeepingLiveOverCall(ArrayRef Tys) = 0; + virtual InstructionCost + getCostOfKeepingLiveOverCall(ArrayRef Tys) = 0; virtual bool getTgtMemIntrinsic(IntrinsicInst *Inst, MemIntrinsicInfo &Info) = 0; virtual unsigned getAtomicMemIntrinsicMaxElementSize() const = 0; @@ -2190,7 +2191,7 @@ const SCEV *Ptr) override { return Impl.getAddressComputationCost(Ty, SE, Ptr); } - unsigned getCostOfKeepingLiveOverCall(ArrayRef Tys) override { + InstructionCost getCostOfKeepingLiveOverCall(ArrayRef Tys) override { return Impl.getCostOfKeepingLiveOverCall(Tys); } bool getTgtMemIntrinsic(IntrinsicInst *Inst, diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h --- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -636,7 +636,7 @@ return 1; } - unsigned getCostOfKeepingLiveOverCall(ArrayRef Tys) const { + InstructionCost getCostOfKeepingLiveOverCall(ArrayRef Tys) const { return 0; } diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp --- a/llvm/lib/Analysis/TargetTransformInfo.cpp +++ b/llvm/lib/Analysis/TargetTransformInfo.cpp @@ -917,7 +917,7 @@ CostKind); } -unsigned +InstructionCost TargetTransformInfo::getCostOfKeepingLiveOverCall(ArrayRef Tys) const { return TTIImpl->getCostOfKeepingLiveOverCall(Tys); } diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h --- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h +++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h @@ -193,7 +193,7 @@ TTI::TargetCostKind CostKind, const Instruction *I = nullptr); - int getCostOfKeepingLiveOverCall(ArrayRef Tys); + InstructionCost getCostOfKeepingLiveOverCall(ArrayRef Tys); void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP); diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp --- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp @@ -1286,7 +1286,8 @@ UseMaskForCond, UseMaskForGaps); } -int AArch64TTIImpl::getCostOfKeepingLiveOverCall(ArrayRef Tys) { +InstructionCost +AArch64TTIImpl::getCostOfKeepingLiveOverCall(ArrayRef Tys) { InstructionCost Cost = 0; TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput; for (auto *I : Tys) { @@ -1297,7 +1298,7 @@ Cost += getMemoryOpCost(Instruction::Store, I, Align(128), 0, CostKind) + getMemoryOpCost(Instruction::Load, I, Align(128), 0, CostKind); } - return *Cost.getValue(); + return Cost; } unsigned AArch64TTIImpl::getMaxInterleaveFactor(unsigned VF) {