[llvm] r360124 - [llvm-exegesis] InstructionBenchmark::writeYamlTo(): don't forget to flush()

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 02:21:13 PDT 2019


Author: lebedevri
Date: Tue May  7 02:21:13 2019
New Revision: 360124

URL: http://llvm.org/viewvc/llvm-project?rev=360124&view=rev
Log:
[llvm-exegesis] InstructionBenchmark::writeYamlTo(): don't forget to flush()

This *APPEARS* to fix a *very* infuriating issue of Yaml's being corrupted,
partially written, truncated. Or at least i'm not seeing the issue
on a new benchmark sweep.

The issue is somewhat rare, happens maybe once in 1000 benchmarks.
Which means there are up to hundreds of broken benchmarks
for a full x86 sweep in a single mode.

Modified:
    llvm/trunk/tools/llvm-exegesis/lib/BenchmarkResult.cpp

Modified: llvm/trunk/tools/llvm-exegesis/lib/BenchmarkResult.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/BenchmarkResult.cpp?rev=360124&r1=360123&r2=360124&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/BenchmarkResult.cpp (original)
+++ llvm/trunk/tools/llvm-exegesis/lib/BenchmarkResult.cpp Tue May  7 02:21:13 2019
@@ -9,6 +9,7 @@
 #include "BenchmarkResult.h"
 #include "BenchmarkRunner.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/bit.h"
@@ -374,6 +375,7 @@ InstructionBenchmark::readYamls(const LL
 
 llvm::Error InstructionBenchmark::writeYamlTo(const LLVMState &State,
                                               llvm::raw_ostream &OS) {
+  auto Cleanup = make_scope_exit([&] { OS.flush(); });
   llvm::yaml::Output Yout(OS, nullptr /*Ctx*/, 200 /*WrapColumn*/);
   YamlContext Context(State);
   Yout.beginDocuments();




More information about the llvm-commits mailing list