[llvm] a05910a - [llvm-exegesis] Use ExitOnErr instead of manually logging and exiting

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 18:42:54 PDT 2024


Author: Aiden Grossman
Date: 2024-03-13T18:42:47-07:00
New Revision: a05910a270ccdda2256e1ccef5fdbb583d22ae0b

URL: https://github.com/llvm/llvm-project/commit/a05910a270ccdda2256e1ccef5fdbb583d22ae0b
DIFF: https://github.com/llvm/llvm-project/commit/a05910a270ccdda2256e1ccef5fdbb583d22ae0b.diff

LOG: [llvm-exegesis] Use ExitOnErr instead of manually logging and exiting

This patch removes an explicit use of dbgs() and exit when logging an
error to explicitly use ExitOnErr as this is the canonical way to do
this within exegesis.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
index 1ae2565e894c69..06e1c7f3c1bbed 100644
--- a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
+++ b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
@@ -423,10 +423,9 @@ static void runBenchmarkConfigurations(
         if (Err) {
           // Errors from executing the snippets are fine.
           // All other errors are a framework issue and should fail.
-          if (!Err.isA<SnippetExecutionFailure>()) {
-            llvm::errs() << "llvm-exegesis error: " << toString(std::move(Err));
-            exit(1);
-          }
+          if (!Err.isA<SnippetExecutionFailure>())
+            ExitOnErr(std::move(Err));
+
           BenchmarkResult.Error = toString(std::move(Err));
         }
         AllResults.push_back(std::move(BenchmarkResult));


        


More information about the llvm-commits mailing list