[llvm] [LV] Fix cost misaligned when gather/scatter w/ addr is uniform. (PR #157387)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 9 01:44:37 PDT 2025


================
@@ -6905,6 +6905,17 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
       if (isa<VPPartialReductionRecipe>(&R))
         return true;
 
+      // The VPlan-based cost model can analysis if recipes is scalar
+      // recursively, but legacy cost model cannot.
+      if (auto *WidenMemR = dyn_cast<VPWidenMemoryRecipe>(&R)) {
+        if (WidenMemR &&
+            vputils::isSingleScalar(WidenMemR->getAddr()) !=
+                CostCtx.CM.Legal->isUniform(
----------------
fhahn wrote:

Can this use `isLegacyUniformAfterVectorization`, as the code does below?
```suggestion
                CostCtx.isLegacyUniformAfterVectorization(
```

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


More information about the llvm-commits mailing list