[llvm] [LV] Use llvm::all_of in LoopVectorizationCostModel::getMaximizedVFForTarget. NFC (PR #99585)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 01:46:35 PDT 2024


================
@@ -4589,15 +4589,12 @@ ElementCount LoopVectorizationCostModel::getMaximizedVFForTarget(
 
     // Select the largest VF which doesn't require more registers than existing
     // ones.
-    for (int i = RUs.size() - 1; i >= 0; --i) {
-      bool Selected = true;
-      for (auto &pair : RUs[i].MaxLocalUsers) {
-        unsigned TargetNumRegisters = TTI.getNumberOfRegisters(pair.first);
-        if (pair.second > TargetNumRegisters)
-          Selected = false;
-      }
-      if (Selected) {
-        MaxVF = VFs[i];
+    for (int I = RUs.size() - 1; I >= 0; --I) {
+      const auto &MLU = RUs[I].MaxLocalUsers;
+      if (llvm::all_of(MLU, [&](decltype(MLU.front()) &LU) {
----------------
fhahn wrote:

nit: `llvm::` should not be needed

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


More information about the llvm-commits mailing list