[llvm] [AArch64] Enable other cost kinds for getCmpSelInstrCost. (PR #144375)

David Green via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 29 13:41:48 PDT 2025


================
@@ -4264,11 +4264,6 @@ InstructionCost AArch64TTIImpl::getCmpSelInstrCost(
     unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred,
     TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info,
     TTI::OperandValueInfo Op2Info, const Instruction *I) const {
-  // TODO: Handle other cost kinds.
-  if (CostKind != TTI::TCK_RecipThroughput)
----------------
davemgreen wrote:

Hi - We have not historically handled all the code kinds well for all operations. For example vector operations are only really handled for throughput costs, but should have higher codesize and maybe latency costs too. I've started working through trying to fix them, but some cause issues here and there so it is a bit slow going. You can see a lot of the costs inaccuracies for codesize in https://davemgreen.github.io/codesize.html (although they may never be perfect).

RecipThroughput is used for loop- and slp-vectorization and a number of other places, so is fairly well supported. The other cost kinds like CodeSize are used for minsize or unrolling loops, for example.

There are further areas of improvement in #145568, this is the first step.

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


More information about the llvm-commits mailing list