[llvm] [LoopVectorizer] Prune VFs based on plan register pressure (PR #132190)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 14 08:47:36 PDT 2025
================
@@ -4550,11 +4777,21 @@ VectorizationFactor LoopVectorizationPlanner::selectVectorizationFactor() {
}
for (auto &P : VPlans) {
- for (ElementCount VF : P->vectorFactors()) {
+ SmallVector<ElementCount, 1> VFs(P->vectorFactors());
+ auto RUs = ::calculateRegisterUsage(*P, VFs, TTI, CM.ValuesToIgnore);
+ for (auto [VF, RU] : zip_equal(VFs, RUs)) {
----------------
sdesmalen-arm wrote:
nit: to avoid having to create a separate `SmallVector<> VFs`, I'd suggest doing:
```suggestion
auto RUs = ::calculateRegisterUsage(*P, VFs, TTI, CM.ValuesToIgnore);
for (auto [I, VF] : enumerate(VFs)) {
```
and use it as `RUs[I].MaxLocalUsers` below.
https://github.com/llvm/llvm-project/pull/132190
More information about the llvm-commits
mailing list