[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 12:18:26 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:

I've updated the above comment, this should work.

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


More information about the llvm-commits mailing list