[llvm] r332230 - [llvm-exegesis] Fix a warning in r332221

Clement Courbet via llvm-commits llvm-commits at lists.llvm.org
Mon May 14 04:31:02 PDT 2018


Author: courbet
Date: Mon May 14 04:31:02 2018
New Revision: 332230

URL: http://llvm.org/viewvc/llvm-project?rev=332230&view=rev
Log:
[llvm-exegesis] Fix a warning in r332221

comparison of integers of different signs: 'const unsigned long' and 'const int' [-Werror,-Wsign-compare]

unittests/tools/llvm-exegesis/BenchmarkResultTest.cpp:60:5: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<unsigned long, int>' requested here
    ASSERT_EQ(FromDiskVector.size(), 1);

Modified:
    llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp
    llvm/trunk/unittests/tools/llvm-exegesis/BenchmarkResultTest.cpp

Modified: llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp?rev=332230&r1=332229&r2=332230&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp (original)
+++ llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp Mon May 14 04:31:02 2018
@@ -17,20 +17,13 @@ void renderInstructionRow(const Instruct
   OS << "\n";
 }
 
-void analyzeCluster(const std::vector<InstructionBenchmark> &Points,
-                    const llvm::MCSubtargetInfo &STI,
-                    const InstructionBenchmarkClustering::Cluster &Cluster,
-                    llvm::raw_ostream &OS) {
+void printCluster(const std::vector<InstructionBenchmark> &Points,
+                  const llvm::MCSubtargetInfo &STI,
+                  const size_t ClusterId,
+                  const InstructionBenchmarkClustering::Cluster &Cluster,
+                  llvm::raw_ostream &OS) {
   // TODO:
-  // std::sort(Cluster.PointIndices.begin(), Cluster.PointIndices.end(),
-  // [](int PointIdA, int PointIdB) { return GetSchedClass(Points[PointIdA]) <
   // GetSchedClass(Points[PointIdB]); });
-  OS << "Cluster:\n";
-  // Get max length of the name for alignement.
-  size_t NameLen = 0;
-  for (const auto &PointId : Cluster.PointIndices) {
-    NameLen = std::max(NameLen, Points[PointId].AsmTmpl.Name.size());
-  }
 
   // Print all points.
   for (const auto &PointId : Cluster.PointIndices) {
@@ -43,10 +36,10 @@ void analyzeCluster(const std::vector<In
 llvm::Error
 printAnalysisClusters(const InstructionBenchmarkClustering &Clustering,
                       const llvm::MCSubtargetInfo &STI, llvm::raw_ostream &OS) {
-
-  for (const auto &Cluster : Clustering.getValidClusters()) {
-    analyzeCluster(Clustering.getPoints(), STI, Cluster, OS);
-    OS << "\n\n\n";
+  OS << "cluster_id,key,";
+  for (size_t I = 0, E = Clustering.getValidClusters().size(); I < E; ++I) {
+    printCluster(Clustering.getPoints(), STI, I, Clustering.getValidClusters()[I], OS);
+    OS << "\n\n";
   }
 
   return llvm::Error::success();

Modified: llvm/trunk/unittests/tools/llvm-exegesis/BenchmarkResultTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/tools/llvm-exegesis/BenchmarkResultTest.cpp?rev=332230&r1=332229&r2=332230&view=diff
==============================================================================
--- llvm/trunk/unittests/tools/llvm-exegesis/BenchmarkResultTest.cpp (original)
+++ llvm/trunk/unittests/tools/llvm-exegesis/BenchmarkResultTest.cpp Mon May 14 04:31:02 2018
@@ -57,7 +57,7 @@ TEST(BenchmarkResultTest, WriteToAndRead
   {
     // Vector version.
     const auto FromDiskVector = InstructionBenchmark::readYamlsOrDie(Filename);
-    ASSERT_EQ(FromDiskVector.size(), 1);
+    ASSERT_EQ(FromDiskVector.size(), size_t{1});
     const auto FromDisk = FromDiskVector[0];
     EXPECT_EQ(FromDisk.AsmTmpl.Name, ToDisk.AsmTmpl.Name);
     EXPECT_EQ(FromDisk.CpuName, ToDisk.CpuName);




More information about the llvm-commits mailing list