[PATCH] D48004: [llvm-exegesis] Program should succeed if benchmark returns StringError.

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 11 02:10:47 PDT 2018


gchatelet created this revision.
gchatelet added a reviewer: courbet.
Herald added subscribers: llvm-commits, tschuett.

Fix for https://bugs.llvm.org/show_bug.cgi?id=37759.


Repository:
  rL LLVM

https://reviews.llvm.org/D48004

Files:
  tools/llvm-exegesis/llvm-exegesis.cpp


Index: tools/llvm-exegesis/llvm-exegesis.cpp
===================================================================
--- tools/llvm-exegesis/llvm-exegesis.cpp
+++ tools/llvm-exegesis/llvm-exegesis.cpp
@@ -200,7 +200,7 @@
     llvm::errs() << "unknown target '" << Points[0].LLVMTriple << "'\n";
     return;
   }
-  const auto Clustering = llvm::cantFail(InstructionBenchmarkClustering::create(
+  const auto Clustering = ExitOnErr(InstructionBenchmarkClustering::create(
       Points, AnalysisNumPoints, AnalysisEpsilon));
 
   const Analysis Analyzer(*TheTarget, Clustering);
@@ -217,6 +217,12 @@
 int main(int Argc, char **Argv) {
   llvm::cl::ParseCommandLineOptions(Argc, Argv, "");
 
+  exegesis::ExitOnErr.setExitCodeMapper([](const llvm::Error &Err) {
+    if (Err.isA<llvm::StringError>())
+      return EXIT_SUCCESS;
+    return 1;
+  });
+
   if (BenchmarkMode == BenchmarkModeE::Analysis) {
     exegesis::analysisMain();
   } else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48004.150691.patch
Type: text/x-patch
Size: 943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180611/f5f438d6/attachment.bin>


More information about the llvm-commits mailing list