[llvm] [SLP] Replace most uses of for_each with range-for loops. NFC (PR #136146)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 08:43:30 PDT 2025


================
@@ -21032,17 +21038,17 @@ bool SLPVectorizerPass::vectorizeStores(
       unsigned Sz = 1 + Log2_32(MaxVF) - Log2_32(MinVF);
       SmallVector<unsigned> CandidateVFs(Sz + (NonPowerOf2VF > 0 ? 1 : 0));
       unsigned Size = MinVF;
-      for_each(reverse(CandidateVFs), [&](unsigned &VF) {
+      for (unsigned &VF : reverse(CandidateVFs)) {
         VF = Size > MaxVF ? NonPowerOf2VF : Size;
         Size *= 2;
-      });
+      }
       unsigned End = Operands.size();
       unsigned Repeat = 0;
       constexpr unsigned MaxAttempts = 4;
       OwningArrayRef<std::pair<unsigned, unsigned>> RangeSizes(Operands.size());
-      for_each(RangeSizes, [](std::pair<unsigned, unsigned> &P) {
+      for (std::pair<unsigned, unsigned> &P : RangeSizes) {
         P.first = P.second = 1;
-      });
+      }
----------------
alexey-bataev wrote:

Drop braces

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


More information about the llvm-commits mailing list