[PATCH] D54393: [llvm-exegesis] Move InstructionBenchmarkClustering::isNeighbour() into header

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 19 05:31:51 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL347203: [llvm-exegesis] Move InstructionBenchmarkClustering::isNeighbour() into header (authored by lebedevri, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D54393?vs=173562&id=174598#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D54393

Files:
  llvm/trunk/tools/llvm-exegesis/lib/Clustering.cpp
  llvm/trunk/tools/llvm-exegesis/lib/Clustering.h


Index: llvm/trunk/tools/llvm-exegesis/lib/Clustering.h
===================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/Clustering.h
+++ llvm/trunk/tools/llvm-exegesis/lib/Clustering.h
@@ -90,7 +90,14 @@
 
   // Returns true if the given point is within a distance Epsilon of each other.
   bool isNeighbour(const std::vector<BenchmarkMeasure> &P,
-                   const std::vector<BenchmarkMeasure> &Q) const;
+                   const std::vector<BenchmarkMeasure> &Q) const {
+    double DistanceSquared = 0.0;
+    for (size_t I = 0, E = P.size(); I < E; ++I) {
+      const auto Diff = P[I].PerInstructionValue - Q[I].PerInstructionValue;
+      DistanceSquared += Diff * Diff;
+    }
+    return DistanceSquared <= EpsilonSquared_;
+  }
 
 private:
   InstructionBenchmarkClustering(
Index: llvm/trunk/tools/llvm-exegesis/lib/Clustering.cpp
===================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/Clustering.cpp
+++ llvm/trunk/tools/llvm-exegesis/lib/Clustering.cpp
@@ -49,17 +49,6 @@
   }
 }
 
-bool InstructionBenchmarkClustering::isNeighbour(
-    const std::vector<BenchmarkMeasure> &P,
-    const std::vector<BenchmarkMeasure> &Q) const {
-  double DistanceSquared = 0.0;
-  for (size_t I = 0, E = P.size(); I < E; ++I) {
-    const auto Diff = P[I].PerInstructionValue - Q[I].PerInstructionValue;
-    DistanceSquared += Diff * Diff;
-  }
-  return DistanceSquared <= EpsilonSquared_;
-}
-
 InstructionBenchmarkClustering::InstructionBenchmarkClustering(
     const std::vector<InstructionBenchmark> &Points,
     const double EpsilonSquared)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54393.174598.patch
Type: text/x-patch
Size: 1652 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181119/bd64faea/attachment.bin>


More information about the llvm-commits mailing list