[llvm] [X86][CostModel] Estimate the codesize cost of switch (PR #163569)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 15 09:46:25 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();
----------------
RKSimon wrote:

This doesn't seem very x86-specific - can we move it to the base impl instead?

https://github.com/llvm/llvm-project/pull/163569


More information about the llvm-commits mailing list