From c7b25faaac022c93ba32a7c97ebb675ed1b05f89 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 9 Sep 2023 00:27:23 -0700 Subject: [PATCH] [llvm-exegesis] Use range-based for loops (NFC) --- llvm/tools/llvm-exegesis/lib/Clustering.cpp | 6 ++---- llvm/tools/llvm-exegesis/llvm-exegesis.cpp | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.cpp b/llvm/tools/llvm-exegesis/lib/Clustering.cpp index c7024629426c..1f1fca4d530b 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 774e54ffe8b6..261335a817d0 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 &Repetitor) { - AllReservedRegs |= Repetitor->getReservedRegs(); - }); + for (const std::unique_ptr &Repetitor : Repetitors) + AllReservedRegs |= Repetitor->getReservedRegs(); std::vector Configurations; if (!Opcodes.empty()) {