[llvm-exegesis] Get rid of debug_string.

Summary:
THis is a backwards-compatible change (existing files will work as
expected).

See PR39082.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D52546

llvm-svn: 343108
diff --git a/llvm/tools/llvm-exegesis/lib/Analysis.cpp b/llvm/tools/llvm-exegesis/lib/Analysis.cpp
index 54dc4be..1da36b2 100644
--- a/llvm/tools/llvm-exegesis/lib/Analysis.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Analysis.cpp
@@ -248,10 +248,7 @@
   for (const auto &Measurement :
        Points[Clusters[0].getPointIds()[0]].Measurements) {
     OS << "<th>";
-    if (Measurement.DebugString.empty())
-      writeEscaped<kEscapeHtml>(OS, Measurement.Key);
-    else
-      writeEscaped<kEscapeHtml>(OS, Measurement.DebugString);
+    writeEscaped<kEscapeHtml>(OS, Measurement.Key);
     OS << "</th>";
   }
   OS << "</tr>";
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
index 1748c53..a3dd56c 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
@@ -164,10 +164,13 @@
 // e.g. { "key": "the key", "value": 0123 }
 template <> struct MappingTraits<exegesis::BenchmarkMeasure> {
   static void mapping(IO &Io, exegesis::BenchmarkMeasure &Obj) {
-    Io.mapOptional("debug_string", Obj.DebugString);
+    Io.mapRequired("key", Obj.Key);
+    if (!Io.outputting()) {
+      // For backward compatibility, interpret debug_string as a key.
+      Io.mapOptional("debug_string", Obj.Key);
+    }
     Io.mapRequired("value", Obj.PerInstructionValue);
     Io.mapOptional("per_snippet_value", Obj.PerSnippetValue);
-    Io.mapRequired("key", Obj.Key);
   }
   static const bool flow = true;
 };
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
index 0fcf4e9..961c07b 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
@@ -43,7 +43,7 @@
 struct BenchmarkMeasure {
   // A helper to create an unscaled BenchmarkMeasure.
   static BenchmarkMeasure Create(std::string Key, double Value) {
-    return {Key, Value, Value, Key};
+    return {Key, Value, Value};
   }
   std::string Key;
   // This is the per-instruction value, i.e. measured quantity scaled per
@@ -52,8 +52,6 @@
   // This is the per-snippet value, i.e. measured quantity for one repetition of
   // the whole snippet.
   double PerSnippetValue;
-  // FIXME: remove, use `Key` instead.
-  std::string DebugString;
 };
 
 // The result of an instruction benchmark.