[PATCH] D54514: [llvm-exegesis] InstructionBenchmarkClustering::dbScan(): use manual std::deque<size_t> + std::vector<char> instead of SetVector.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 19 04:09:18 PST 2018


lebedev.ri added a comment.

@courbet this is the last one..



================
Comment at: tools/llvm-exegesis/lib/Clustering.cpp:114-117
     // Process P's neighbors.
-    llvm::SetVector<size_t, std::deque<size_t>> ToProcess;
-    ToProcess.insert(Neighbors.begin(), Neighbors.end());
-    while (!ToProcess.empty()) {
+    Workqueue.assign(Neighbors.begin(), Neighbors.end());
+    for (size_t Neighbor : Neighbors)
+      Set[Neighbor] = 1;
----------------
There is basically just one interesting point here, as of now.
Each time we do `pop_front` (until there is something to pop), we remove from set too.
So when the vector is empty, the set is empty too.
So we don't need to zero-init the set.


Repository:
  rL LLVM

https://reviews.llvm.org/D54514





More information about the llvm-commits mailing list