[llvm] c7b25fa - [llvm-exegesis] Use range-based for loops (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 9 00:27:29 PDT 2023


Author: Kazu Hirata
Date: 2023-09-09T00:27:23-07:00
New Revision: c7b25faaac022c93ba32a7c97ebb675ed1b05f89

URL: https://github.com/llvm/llvm-project/commit/c7b25faaac022c93ba32a7c97ebb675ed1b05f89
DIFF: https://github.com/llvm/llvm-project/commit/c7b25faaac022c93ba32a7c97ebb675ed1b05f89.diff

LOG: [llvm-exegesis] Use range-based for loops (NFC)

Added: 
    

Modified: 
    llvm/tools/llvm-exegesis/lib/Clustering.cpp
    llvm/tools/llvm-exegesis/llvm-exegesis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-exegesis/lib/Clustering.cpp b/llvm/tools/llvm-exegesis/lib/Clustering.cpp
index c7024629426ccbb..1f1fca4d530bac9 100644
--- a/llvm/tools/llvm-exegesis/lib/Clustering.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Clustering.cpp
@@ -307,10 +307,8 @@ void BenchmarkClustering::stabilize(unsigned NumOpcodes) {
       assert(std::distance(it, OldCluster.PointIndices.end()) > 0 &&
              "Should have found at least one bad point");
       // Mark to-be-moved points as belonging to the new cluster.
-      std::for_each(it, OldCluster.PointIndices.end(),
-                    [this, &UnstableCluster](size_t P) {
-                      ClusterIdForPoint_[P] = UnstableCluster.Id;
-                    });
+      for (size_t P : llvm::make_range(it, OldCluster.PointIndices.end()))
+        ClusterIdForPoint_[P] = UnstableCluster.Id;
       // Actually append to-be-moved points to the new cluster.
       UnstableCluster.PointIndices.insert(UnstableCluster.PointIndices.end(),
                                           it, OldCluster.PointIndices.end());

diff  --git a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
index 774e54ffe8b6fe7..261335a817d0674 100644
--- a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
+++ b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
@@ -503,11 +503,8 @@ void benchmarkMain() {
   }
 
   BitVector AllReservedRegs;
-  llvm::for_each(Repetitors,
-                 [&AllReservedRegs](
-                     const std::unique_ptr<const SnippetRepetitor> &Repetitor) {
-                   AllReservedRegs |= Repetitor->getReservedRegs();
-                 });
+  for (const std::unique_ptr<const SnippetRepetitor> &Repetitor : Repetitors)
+    AllReservedRegs |= Repetitor->getReservedRegs();
 
   std::vector<BenchmarkCode> Configurations;
   if (!Opcodes.empty()) {


        


More information about the llvm-commits mailing list