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

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 06:40:31 PDT 2025


================
@@ -7759,7 +7535,10 @@ VectorizationFactor LoopVectorizationPlanner::computeBestVF() {
   }
 
   for (auto &P : VPlans) {
-    for (ElementCount VF : P->vectorFactors()) {
+    SmallVector<ElementCount, 1> VFs(P->vectorFactors());
+    auto RUs = ::calculateRegisterUsage(*P, VFs, TTI);
+    for (unsigned I = 0; I < VFs.size(); I++) {
+      auto VF = VFs[I];
----------------
MacDue wrote:

Note: Prefer `zip_equal` if the lengths of the arrays are the same :)

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


More information about the llvm-commits mailing list