[llvm] [VPlan] Compute the cost for vector icmp and fcmp (PR #193268)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 05:06:26 PDT 2026


================
@@ -1257,6 +1257,12 @@ InstructionCost VPInstruction::computeCost(ElementCount VF,
     return Ctx.TTI.getIndexedVectorInstrCostFromEnd(Instruction::ExtractElement,
                                                     VecTy, Ctx.CostKind, 0);
   }
+  case Instruction::FCmp:
+  case Instruction::ICmp:
+    // FIXME: Scalar compares are handled by the legacy cost model
----------------
david-arm wrote:

I'm in the process of trying to reduce the number of times we fall back on the legacy cost model for REPLICATE recipes. I started it with sdiv/udiv and plan to extend it to other operations too, however it's a very complex and tangled web. I am currently trying to do this for stores, but then I've discovered that the load/store cost model in VPReplicateRecipe::computeCost seems to be double-counting the cost of address calculation so I've now started working on a fix for that. Unfortunately, I think it's going to take some time to stop falling back on the legacy cost model completely.

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


More information about the llvm-commits mailing list