[llvm] r334395 - [llvm-exegesis] Program should succeed if benchmark returns StringError.

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 11 02:18:01 PDT 2018


Author: gchatelet
Date: Mon Jun 11 02:18:01 2018
New Revision: 334395

URL: http://llvm.org/viewvc/llvm-project?rev=334395&view=rev
Log:
[llvm-exegesis] Program should succeed if benchmark returns StringError.

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

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

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

Modified: llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp?rev=334395&r1=334394&r2=334395&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp (original)
+++ llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp Mon Jun 11 02:18:01 2018
@@ -200,7 +200,7 @@ static void analysisMain() {
     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 @@ static void analysisMain() {
 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 EXIT_FAILURE;
+  });
+
   if (BenchmarkMode == BenchmarkModeE::Analysis) {
     exegesis::analysisMain();
   } else {




More information about the llvm-commits mailing list