From 1d522a39f7ed7a0c60849a689f56172203911916 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Wed, 17 Aug 2022 11:41:38 +0100 Subject: [PATCH] [TTI] Remove getInstructionThroughput cost helper. Pulled out of D79483 - we can just as easily use getUserCost directly --- llvm/include/llvm/Analysis/TargetTransformInfo.h | 8 +--- llvm/lib/Analysis/TargetTransformInfo.cpp | 59 ------------------------ 2 files changed, 1 insertion(+), 66 deletions(-) diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h index c838df9..8ff6626 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfo.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h @@ -230,12 +230,10 @@ public: enum TargetCostKind kind) const { InstructionCost Cost; switch (kind) { - case TCK_RecipThroughput: - Cost = getInstructionThroughput(I); - break; case TCK_Latency: Cost = getInstructionLatency(I); break; + case TCK_RecipThroughput: case TCK_CodeSize: case TCK_SizeAndLatency: Cost = getUserCost(I, kind); @@ -1525,10 +1523,6 @@ private: /// Returns 1 as the default value. InstructionCost getInstructionLatency(const Instruction *I) const; - /// Returns the expected throughput cost of the instruction. - /// Returns -1 if the cost is unknown. - InstructionCost getInstructionThroughput(const Instruction *I) const; - /// The abstract base class used to type erase specific TTI /// implementations. class Concept; diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp index eba58a0..382ed27 100644 --- a/llvm/lib/Analysis/TargetTransformInfo.cpp +++ b/llvm/lib/Analysis/TargetTransformInfo.cpp @@ -1154,65 +1154,6 @@ TargetTransformInfo::getInstructionLatency(const Instruction *I) const { return TTIImpl->getInstructionLatency(I); } -InstructionCost -TargetTransformInfo::getInstructionThroughput(const Instruction *I) const { - TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput; - - switch (I->getOpcode()) { - case Instruction::GetElementPtr: - case Instruction::Ret: - case Instruction::PHI: - case Instruction::Br: - case Instruction::Add: - case Instruction::FAdd: - case Instruction::Sub: - case Instruction::FSub: - case Instruction::Mul: - case Instruction::FMul: - case Instruction::UDiv: - case Instruction::SDiv: - case Instruction::FDiv: - case Instruction::URem: - case Instruction::SRem: - case Instruction::FRem: - case Instruction::Shl: - case Instruction::LShr: - case Instruction::AShr: - case Instruction::And: - case Instruction::Or: - case Instruction::Xor: - case Instruction::FNeg: - case Instruction::Select: - case Instruction::ICmp: - case Instruction::FCmp: - case Instruction::Store: - case Instruction::Load: - case Instruction::ZExt: - case Instruction::SExt: - case Instruction::FPToUI: - case Instruction::FPToSI: - case Instruction::FPExt: - case Instruction::PtrToInt: - case Instruction::IntToPtr: - case Instruction::SIToFP: - case Instruction::UIToFP: - case Instruction::Trunc: - case Instruction::FPTrunc: - case Instruction::BitCast: - case Instruction::AddrSpaceCast: - case Instruction::ExtractElement: - case Instruction::InsertElement: - case Instruction::ExtractValue: - case Instruction::ShuffleVector: - case Instruction::Call: - case Instruction::Switch: - return getUserCost(I, CostKind); - default: - // We don't have any information on this instruction. - return -1; - } -} - TargetTransformInfo::Concept::~Concept() = default; TargetIRAnalysis::TargetIRAnalysis() : TTICallback(&getDefaultTTI) {} -- 2.7.4