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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 06:14:51 PDT 2025


================
@@ -7772,12 +7551,23 @@ VectorizationFactor LoopVectorizationPlanner::computeBestVF() {
 
       InstructionCost Cost = cost(*P, VF);
       VectorizationFactor CurrentFactor(VF, Cost, ScalarCost);
-      if (isMoreProfitable(CurrentFactor, BestFactor))
-        BestFactor = CurrentFactor;
-
       // If profitable add it to ProfitableVF list.
       if (isMoreProfitable(CurrentFactor, ScalarFactor))
         ProfitableVFs.push_back(CurrentFactor);
----------------
lukel97 wrote:

Previously when the VFs were pruned in getMaximizedVFForTarget I presume they wouldn't have been added to the ProfitableVFs list either. Should the register usage check be moved above this too?

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


More information about the llvm-commits mailing list