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 @@ -263,9 +263,10 @@ }; /// Estimate the cost of a GEP operation when lowered. - int getGEPCost(Type *PointeeType, const Value *Ptr, - ArrayRef Operands, - TargetCostKind CostKind = TCK_SizeAndLatency) const; + InstructionCost + getGEPCost(Type *PointeeType, const Value *Ptr, + ArrayRef Operands, + TargetCostKind CostKind = TCK_SizeAndLatency) const; /// \returns A value by which our inlining threshold should be multiplied. /// This is primarily used to bump up the inlining threshold wholesale on @@ -1401,9 +1402,9 @@ public: virtual ~Concept() = 0; virtual const DataLayout &getDataLayout() const = 0; - virtual int getGEPCost(Type *PointeeType, const Value *Ptr, - ArrayRef Operands, - TTI::TargetCostKind CostKind) = 0; + virtual InstructionCost getGEPCost(Type *PointeeType, const Value *Ptr, + ArrayRef Operands, + TTI::TargetCostKind CostKind) = 0; virtual unsigned getInliningThresholdMultiplier() = 0; virtual unsigned adjustInliningThreshold(const CallBase *CB) = 0; virtual int getInlinerVectorBonusPercent() = 0; @@ -1693,9 +1694,10 @@ return Impl.getDataLayout(); } - int getGEPCost(Type *PointeeType, const Value *Ptr, - ArrayRef Operands, - enum TargetTransformInfo::TargetCostKind CostKind) override { + InstructionCost + getGEPCost(Type *PointeeType, const Value *Ptr, + ArrayRef Operands, + enum TargetTransformInfo::TargetCostKind CostKind) override { return Impl.getGEPCost(PointeeType, Ptr, Operands); } unsigned getInliningThresholdMultiplier() override { 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 @@ -47,9 +47,10 @@ const DataLayout &getDataLayout() const { return DL; } - int getGEPCost(Type *PointeeType, const Value *Ptr, - ArrayRef Operands, - TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency) const { + InstructionCost + getGEPCost(Type *PointeeType, const Value *Ptr, + ArrayRef Operands, + TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency) const { // In the basic model, we just assume that all-constant GEPs will be folded // into their uses via addressing modes. for (unsigned Idx = 0, Size = Operands.size(); Idx != Size; ++Idx) @@ -841,9 +842,10 @@ public: using BaseT::getGEPCost; - int getGEPCost(Type *PointeeType, const Value *Ptr, - ArrayRef Operands, - TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency) { + InstructionCost + getGEPCost(Type *PointeeType, const Value *Ptr, + ArrayRef Operands, + TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency) { assert(PointeeType && Ptr && "can't get GEPCost of nullptr"); // TODO: will remove this when pointers have an opaque type. assert(Ptr->getType()->getScalarType()->getPointerElementType() == diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h --- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h @@ -310,8 +310,8 @@ return getTLI()->getTypeLegalizationCost(DL, Ty).first; } - int getGEPCost(Type *PointeeType, const Value *Ptr, - ArrayRef Operands) { + InstructionCost getGEPCost(Type *PointeeType, const Value *Ptr, + ArrayRef Operands) { return BaseT::getGEPCost(PointeeType, Ptr, Operands); } 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 @@ -206,9 +206,10 @@ return TTIImpl->getInlinerVectorBonusPercent(); } -int TargetTransformInfo::getGEPCost(Type *PointeeType, const Value *Ptr, - ArrayRef Operands, - TTI::TargetCostKind CostKind) const { +InstructionCost +TargetTransformInfo::getGEPCost(Type *PointeeType, const Value *Ptr, + ArrayRef Operands, + TTI::TargetCostKind CostKind) const { return TTIImpl->getGEPCost(PointeeType, Ptr, Operands, CostKind); }