[PATCH] D83434: [NFC][llvm-reduce] Purify for_each usage in Operand Bundles into range-based for loop

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 15:03:09 PDT 2020


lebedev.ri created this revision.
lebedev.ri added reviewers: dblaikie, nickdesaulniers.
lebedev.ri added a project: LLVM.

As per lengthy/heated disscussion in D83351 <https://reviews.llvm.org/D83351>,
and CodingStandards D83431 <https://reviews.llvm.org/D83431>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83434

Files:
  llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.cpp


Index: llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.cpp
===================================================================
--- llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.cpp
+++ llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.cpp
@@ -56,10 +56,9 @@
     OperandBundlesToKeepIndexes.reserve(Call.getNumOperandBundles());
 
     // Enumerate every operand bundle on this call.
-    for_each(seq(0U, Call.getNumOperandBundles()), [&](unsigned BundleIndex) {
+    for (unsigned BundleIndex : seq(0U, Call.getNumOperandBundles()))
       if (O.shouldKeep()) // Should we keep this one?
         OperandBundlesToKeepIndexes.emplace_back(BundleIndex);
-    });
   }
 };
 
@@ -104,9 +103,8 @@
   OperandBundleRemapper R(ChunksToKeep);
   R.visit(Program);
 
-  for_each(R.CallsToRefine, [](const auto &P) {
-    return maybeRewriteCallWithDifferentBundles(P.first, P.second);
-  });
+  for (const auto &I : R.CallsToRefine)
+    maybeRewriteCallWithDifferentBundles(I.first, I.second);
 }
 
 /// Counts the amount of operand bundles.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83434.276568.patch
Type: text/x-patch
Size: 1044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200708/20bcc65c/attachment.bin>


More information about the llvm-commits mailing list