[llvm] [X86][CostModel] Estimate the codesize cost of switch (PR #163569)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 15 08:30:23 PDT 2025
================
@@ -6155,6 +6155,23 @@ X86TTIImpl::getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx,
InstructionCost X86TTIImpl::getCFInstrCost(unsigned Opcode,
TTI::TargetCostKind CostKind,
const Instruction *I) const {
+ if (Opcode == Instruction::Switch && CostKind == TTI::TCK_CodeSize) {
+ unsigned JumpTableSize, NumSuccs = I->getNumSuccessors();
----------------
nikic wrote:
Do we need to take into account whether the default is unreachable? onFinalizeSwitch() in InlineCost has some more complex logic for this.
https://github.com/llvm/llvm-project/pull/163569
More information about the llvm-commits
mailing list