[llvm] [LV][VPlan] Implement VPlan-based cost for exit condition. (PR #125640)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 13:15:12 PST 2025


================
@@ -823,6 +823,29 @@ bool VPInstruction::onlyFirstPartUsed(const VPValue *Op) const {
   llvm_unreachable("switch should return");
 }
 
+InstructionCost VPInstruction::computeCost(ElementCount VF,
+                                           VPCostContext &Ctx) const {
+  Type *ValTy = Ctx.Types.inferScalarType(getOperand(0));
+
+  switch (getOpcode()) {
+  case VPInstruction::BranchOnCount: {
----------------
fhahn wrote:

It looks like there are a couple of regressions, e.g. `clamped_tc_8`, which are probably related. The legacy cost model for now just considers the cost of the condition, but in some cases we removed the original condition already.

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


More information about the llvm-commits mailing list