diff --git a/include/llvm/Analysis/TargetTransformInfo.h b/include/llvm/Analysis/TargetTransformInfo.h index 9031323ea9d..f24d5d3a07d 100644 --- a/include/llvm/Analysis/TargetTransformInfo.h +++ b/include/llvm/Analysis/TargetTransformInfo.h @@ -293,7 +293,7 @@ public: /// \return the expected cost of a memcpy, which could e.g. depend on the /// source/destination type and alignment and the number of bytes copied. - int getMemcpyCost(const Instruction *I) const; + InstructionCost getMemcpyCost(const Instruction *I) const; /// \return The estimated number of case clusters when lowering \p 'SI'. /// \p JTSize Set a jump table size only when \p SI is suitable for a jump @@ -1408,7 +1408,7 @@ public: virtual unsigned getInliningThresholdMultiplier() = 0; virtual unsigned adjustInliningThreshold(const CallBase *CB) = 0; virtual int getInlinerVectorBonusPercent() = 0; - virtual int getMemcpyCost(const Instruction *I) = 0; + virtual InstructionCost getMemcpyCost(const Instruction *I) = 0; virtual unsigned getEstimatedNumberOfCaseClusters(const SwitchInst &SI, unsigned &JTSize, ProfileSummaryInfo *PSI, @@ -1709,7 +1709,7 @@ public: int getInlinerVectorBonusPercent() override { return Impl.getInlinerVectorBonusPercent(); } - int getMemcpyCost(const Instruction *I) override { + InstructionCost getMemcpyCost(const Instruction *I) override { return Impl.getMemcpyCost(I); } InstructionCost getUserCost(const User *U, ArrayRef Operands, diff --git a/include/llvm/Analysis/TargetTransformInfoImpl.h b/include/llvm/Analysis/TargetTransformInfoImpl.h index a57994cf7f8..c1a84c9320e 100644 --- a/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -75,7 +75,7 @@ public: int getInlinerVectorBonusPercent() const { return 150; } - unsigned getMemcpyCost(const Instruction *I) const { + InstructionCost getMemcpyCost(const Instruction *I) const { return TTI::TCC_Expensive; } diff --git a/lib/Analysis/TargetTransformInfo.cpp b/lib/Analysis/TargetTransformInfo.cpp index cd11fb83acd..b813e7a8f1b 100644 --- a/lib/Analysis/TargetTransformInfo.cpp +++ b/lib/Analysis/TargetTransformInfo.cpp @@ -885,8 +885,8 @@ TargetTransformInfo::getAddressComputationCost(Type *Tp, ScalarEvolution *SE, return Cost; } -int TargetTransformInfo::getMemcpyCost(const Instruction *I) const { - int Cost = TTIImpl->getMemcpyCost(I); +InstructionCost TargetTransformInfo::getMemcpyCost(const Instruction *I) const { + InstructionCost Cost = TTIImpl->getMemcpyCost(I); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } diff --git a/lib/Target/ARM/ARMTargetTransformInfo.cpp b/lib/Target/ARM/ARMTargetTransformInfo.cpp index 7a06ce27292..14e0d596976 100644 --- a/lib/Target/ARM/ARMTargetTransformInfo.cpp +++ b/lib/Target/ARM/ARMTargetTransformInfo.cpp @@ -1126,7 +1126,7 @@ int ARMTTIImpl::getNumMemOps(const IntrinsicInst *I) const { return -1; } -int ARMTTIImpl::getMemcpyCost(const Instruction *I) { +InstructionCost ARMTTIImpl::getMemcpyCost(const Instruction *I) { int NumOps = getNumMemOps(cast(I)); // To model the cost of a library call, we assume 1 for the call, and diff --git a/lib/Target/ARM/ARMTargetTransformInfo.h b/lib/Target/ARM/ARMTargetTransformInfo.h index 09b86b33d90..fef585e51da 100644 --- a/lib/Target/ARM/ARMTargetTransformInfo.h +++ b/lib/Target/ARM/ARMTargetTransformInfo.h @@ -183,7 +183,7 @@ public: return isLegalMaskedGather(Ty, Alignment); } - int getMemcpyCost(const Instruction *I); + InstructionCost getMemcpyCost(const Instruction *I); int getNumMemOps(const IntrinsicInst *I) const;