[llvm] [LV] Fix issue in VPFirstOrderRecurrencePHIRecipe::usesFirstLaneOnly (PR #179977)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 6 04:18:34 PST 2026


================
@@ -2504,7 +2504,13 @@ struct VPFirstOrderRecurrencePHIRecipe : public VPHeaderPHIRecipe {
   bool usesFirstLaneOnly(const VPValue *Op) const override {
     assert(is_contained(operands(), Op) &&
            "Op must be an operand of the recipe");
-    return Op == getStartValue();
+    if (Op == getStartValue())
+      return true;
+
+    // For VF=1 the inputs will be scalar and the output will be scalar, so
+    // check if the users of this PHI only require the first lane too.
----------------
fhahn wrote:

> While testing out a new fix and building the LLVM test suite with -force-target-instruction-cost=1 I've discovered a new VPlan cost model and legacy cost model disagreed assert. I'll look at this next and see if I can rip out more of the legacy cost model so we can remove this assert. 

In any case, the assert was unrelated to the changes to the onlyFirstLaneUsed assertion right?

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


More information about the llvm-commits mailing list