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 @@ -839,8 +839,8 @@ /// with another such as Thumb. This return value is used as a penalty when /// the total costs for a constant is calculated (the bigger the cost, the /// more beneficial constant hoisting is). - int getIntImmCodeSizeCost(unsigned Opc, unsigned Idx, const APInt &Imm, - Type *Ty) const; + InstructionCost getIntImmCodeSizeCost(unsigned Opc, unsigned Idx, + const APInt &Imm, Type *Ty) const; /// @} /// \name Vector Target Information @@ -1556,8 +1556,8 @@ virtual bool haveFastSqrt(Type *Ty) = 0; virtual bool isFCmpOrdCheaperThanFCmpZero(Type *Ty) = 0; virtual InstructionCost getFPOpCost(Type *Ty) = 0; - virtual int getIntImmCodeSizeCost(unsigned Opc, unsigned Idx, - const APInt &Imm, Type *Ty) = 0; + virtual InstructionCost getIntImmCodeSizeCost(unsigned Opc, unsigned Idx, + const APInt &Imm, Type *Ty) = 0; virtual InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, TargetCostKind CostKind) = 0; virtual InstructionCost getIntImmCostInst(unsigned Opc, unsigned Idx, @@ -1988,8 +1988,8 @@ return Impl.getFPOpCost(Ty); } - int getIntImmCodeSizeCost(unsigned Opc, unsigned Idx, const APInt &Imm, - Type *Ty) override { + InstructionCost getIntImmCodeSizeCost(unsigned Opc, unsigned Idx, + const APInt &Imm, Type *Ty) override { return Impl.getIntImmCodeSizeCost(Opc, Idx, Imm, Ty); } InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, 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 @@ -347,8 +347,8 @@ return TargetTransformInfo::TCC_Basic; } - int getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx, const APInt &Imm, - Type *Ty) const { + InstructionCost getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx, + const APInt &Imm, Type *Ty) 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 @@ -536,10 +536,11 @@ return Cost; } -int TargetTransformInfo::getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx, - const APInt &Imm, - Type *Ty) const { - int Cost = TTIImpl->getIntImmCodeSizeCost(Opcode, Idx, Imm, Ty); +InstructionCost TargetTransformInfo::getIntImmCodeSizeCost(unsigned Opcode, + unsigned Idx, + const APInt &Imm, + Type *Ty) const { + InstructionCost Cost = TTIImpl->getIntImmCodeSizeCost(Opcode, Idx, Imm, Ty); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h --- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h +++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h @@ -124,8 +124,8 @@ /// \name Scalar TTI Implementations /// @{ - int getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx, const APInt &Imm, - Type *Ty); + InstructionCost getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx, + const APInt &Imm, Type *Ty); using BaseT::getIntImmCost; InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp --- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp +++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp @@ -283,8 +283,8 @@ // Constants smaller than 256 fit in the immediate field of // Thumb1 instructions so we return a zero cost and 1 otherwise. -int ARMTTIImpl::getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx, - const APInt &Imm, Type *Ty) { +InstructionCost ARMTTIImpl::getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx, + const APInt &Imm, Type *Ty) { if (Imm.isNonNegative() && Imm.getLimitedValue() < 256) return 0;