Index: llvm/include/llvm/Analysis/TargetTransformInfo.h =================================================================== --- llvm/include/llvm/Analysis/TargetTransformInfo.h +++ llvm/include/llvm/Analysis/TargetTransformInfo.h @@ -205,9 +205,6 @@ int getGEPCost(Type *PointeeType, const Value *Ptr, ArrayRef Operands) const; - /// Estimate the cost of a EXT operation when lowered. - int getExtCost(const Instruction *I, const Value *Src) const; - /// \returns A value by which our inlining threshold should be multiplied. /// This is primarily used to bump up the inlining threshold wholesale on /// targets where calls are unusually expensive. @@ -1157,7 +1154,6 @@ virtual const DataLayout &getDataLayout() const = 0; virtual int getGEPCost(Type *PointeeType, const Value *Ptr, ArrayRef Operands) = 0; - virtual int getExtCost(const Instruction *I, const Value *Src) = 0; virtual unsigned getInliningThresholdMultiplier() = 0; virtual int getInlinerVectorBonusPercent() = 0; virtual int getIntrinsicCost(Intrinsic::ID IID, Type *RetTy, @@ -1400,9 +1396,6 @@ ArrayRef Operands) override { return Impl.getGEPCost(PointeeType, Ptr, Operands); } - int getExtCost(const Instruction *I, const Value *Src) override { - return Impl.getExtCost(I, Src); - } unsigned getInliningThresholdMultiplier() override { return Impl.getInliningThresholdMultiplier(); } Index: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h =================================================================== --- llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -64,10 +64,6 @@ return SI.getNumCases(); } - int getExtCost(const Instruction *I, const Value *Src) { - return TTI::TCC_Basic; - } - unsigned getInliningThresholdMultiplier() { return 1; } int getInlinerVectorBonusPercent() { return 150; } @@ -846,13 +842,10 @@ case Instruction::PtrToInt: case Instruction::Trunc: case Instruction::BitCast: - if (TargetTTI->getCastInstrCost(Opcode, Ty, OpTy, I) == TTI::TCC_Free) - return TTI::TCC_Free; - break; case Instruction::FPExt: case Instruction::SExt: case Instruction::ZExt: - if (I && TargetTTI->getExtCost(I, Operands.back()) == TTI::TCC_Free) + if (TargetTTI->getCastInstrCost(Opcode, Ty, OpTy, I) == TTI::TCC_Free) return TTI::TCC_Free; break; } Index: llvm/include/llvm/CodeGen/BasicTTIImpl.h =================================================================== --- llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ llvm/include/llvm/CodeGen/BasicTTIImpl.h @@ -292,18 +292,6 @@ return BaseT::getGEPCost(PointeeType, Ptr, Operands); } - int getExtCost(const Instruction *I, const Value *Src) { - if (getTLI()->isExtFree(I)) - return TargetTransformInfo::TCC_Free; - - if (isa(I) || isa(I)) - if (const LoadInst *LI = dyn_cast(Src)) - if (getTLI()->isExtLoad(LI, I, DL)) - return TargetTransformInfo::TCC_Free; - - return TargetTransformInfo::TCC_Basic; - } - unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy, ArrayRef Arguments, const User *U) { return BaseT::getIntrinsicCost(IID, RetTy, Arguments, U); @@ -720,11 +708,18 @@ SrcSize == DstSize) return 0; break; + case Instruction::FPExt: + if (I && getTLI()->isExtFree(I)) + return TargetTransformInfo::TCC_Free; + break; case Instruction::ZExt: if (TLI->isZExtFree(SrcLT.second, DstLT.second)) return 0; LLVM_FALLTHROUGH; case Instruction::SExt: { + if (I && getTLI()->isExtFree(I)) + return TargetTransformInfo::TCC_Free; + // If this is a zext/sext of a load, return 0 if the corresponding // extending load exists on target. if (I && isa(I->getOperand(0))) { Index: llvm/lib/Analysis/TargetTransformInfo.cpp =================================================================== --- llvm/lib/Analysis/TargetTransformInfo.cpp +++ llvm/lib/Analysis/TargetTransformInfo.cpp @@ -158,11 +158,6 @@ return TTIImpl->getGEPCost(PointeeType, Ptr, Operands); } -int TargetTransformInfo::getExtCost(const Instruction *I, - const Value *Src) const { - return TTIImpl->getExtCost(I, Src); -} - int TargetTransformInfo::getIntrinsicCost(Intrinsic::ID IID, Type *RetTy, ArrayRef Arguments, const User *U) const {