[llvm] [LoopVectorizer] Prune VFs based on plan register pressure (PR #132190)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 01:50:17 PDT 2025


================
@@ -5027,6 +5025,9 @@ calculateRegisterUsage(VPlan &Plan, ArrayRef<ElementCount> VFs,
         if (isa<VPVectorPointerRecipe, VPVectorEndPointerRecipe,
                 VPBranchOnMaskRecipe>(R))
           continue;
+        if (auto *Phi = dyn_cast<VPReductionPHIRecipe>(R);
----------------
lukel97 wrote:

Won't in-loop reductions still carry a scalar register across iterations? Could we just reuse the scalar check below for scalar-use-only recipes:

```c++
            (isa<VPInstruction, VPReductionPHIRecipe>(R) &&
             all_of(cast<VPSingleDefRecipe>(R)->users(), [&](VPUser *U) {
               return cast<VPRecipeBase>(U)->usesScalars(R->getVPSingleValue());
             }))) {
```

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


More information about the llvm-commits mailing list