diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.cpp b/llvm/tools/llvm-exegesis/lib/Clustering.cpp index c7024629426cc..1f1fca4d530ba 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 774e54ffe8b6f..261335a817d06 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()) {