Index: llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h =================================================================== --- llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h +++ llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h @@ -53,9 +53,6 @@ int getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind); - unsigned getUserCost(const User *U, ArrayRef Operands, - TTI::TargetCostKind CostKind); - TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth); bool isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE, AssumptionCache &AC, Index: llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp =================================================================== --- llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp +++ llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp @@ -209,23 +209,6 @@ return PPCTTIImpl::getIntImmCost(Imm, Ty, CostKind); } -unsigned -PPCTTIImpl::getUserCost(const User *U, ArrayRef Operands, - TTI::TargetCostKind CostKind) { - // We already implement getCastInstrCost and getMemoryOpCost where we perform - // the vector adjustment there. - if (isa(U) || isa(U) || isa(U)) - return BaseT::getUserCost(U, Operands, CostKind); - - if (U->getType()->isVectorTy()) { - // Instructions that need to be split should cost more. - std::pair LT = TLI->getTypeLegalizationCost(DL, U->getType()); - return LT.first * BaseT::getUserCost(U, Operands, CostKind); - } - - return BaseT::getUserCost(U, Operands, CostKind); -} - bool PPCTTIImpl::mightUseCTR(BasicBlock *BB, TargetLibraryInfo *LibInfo, SmallPtrSetImpl &Visited) { const PPCTargetMachine &TM = ST->getTargetMachine(); @@ -741,10 +724,17 @@ const Instruction *CxtI) { assert(TLI->InstructionOpcodeToISD(Opcode) && "Invalid opcode"); // TODO: Handle more cost kinds. - if (CostKind != TTI::TCK_RecipThroughput) - return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, - Op2Info, Opd1PropInfo, - Opd2PropInfo, Args, CxtI); + if (CostKind != TTI::TCK_RecipThroughput) { + int Cost = BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, + Op2Info, Opd1PropInfo, + Opd2PropInfo, Args, CxtI); + if (Ty->isVectorTy()) { + // Instructions that need to be split should cost more. + std::pair LT = TLI->getTypeLegalizationCost(DL, Ty); + return LT.first * Cost; + } + return Cost; + } // Fallback to the default implementation. int Cost = BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, @@ -785,8 +775,14 @@ const Instruction *I) { int Cost = BaseT::getCmpSelInstrCost(Opcode, ValTy, CondTy, CostKind, I); // TODO: Handle other cost kinds. - if (CostKind != TTI::TCK_RecipThroughput) + if (CostKind != TTI::TCK_RecipThroughput) { + if (ValTy->isVectorTy()) { + // Instructions that need to be split should cost more. + std::pair LT = TLI->getTypeLegalizationCost(DL, ValTy); + return LT.first * Cost; + } return Cost; + } return vectorCostAdjustment(Cost, Opcode, ValTy, nullptr); }