[llvm] [VPlan] Remove legacy costing inside VPBlendRecipe::computeCost (PR #171846)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 13 04:15:10 PST 2025


================
@@ -7081,6 +7081,11 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
           return true;
       }
 
+      // The legacy cost model costs non-header phis with a scalar VF as a phi,
+      // but scalar unrolled VPlans will have VPBlendRecipes which emit selects.
+      if (VF.isScalar() && isa<VPBlendRecipe>(&R))
----------------
lukel97 wrote:

Woops I think you're absolutely right here, I just noticed this bit in the start of `LoopVectorizationCostModel::getInstructionCost`:

```c++
  // If we know that this instruction will remain uniform, check the cost of
  // the scalar version.
  if (isUniformAfterVectorization(I, VF))
    VF = ElementCount::getFixed(1);
```

I should have heeded your review more, my bad. @fhahn is this what you mean about using `vputils::onlyFirstLaneUsed` when the VF != 1?

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


More information about the llvm-commits mailing list