Author: Aiden Grossman
Date: 2023-12-02T14:20:11-08:00
New Revision: 2bddb1011489651cb2e5f2f94d5fae89ddf63216

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

LOG: [llvm-exegesis] Minor changes for downstream consumers

This patch adjust the runConfiguration function to allow passing a
parameter to force returning SnippetCrashes as errors rather than
serializing them as strings in the returned Benchmark object. In
addition, this patch adds a getter for the signal information address in
the SnippetCrash object.

These are both needed to allow for downstream consumption of the
exegesis library within Gematria.

Added: 
    

Modified: 
    llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
    llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
    llvm/tools/llvm-exegesis/lib/Error.h

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp 
b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index f5d73a8bd6a31..51c9c6cd09358 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -545,9 +545,10 @@ BenchmarkRunner::createFunctionExecutor(
   llvm_unreachable("ExecutionMode is outside expected range");
 }
 
-Expected<Benchmark> BenchmarkRunner::runConfiguration(
-    RunnableConfiguration &&RC,
-    const std::optional<StringRef> &DumpFile) const {
+Expected<Benchmark>
+BenchmarkRunner::runConfiguration(RunnableConfiguration &&RC,
+                                  const std::optional<StringRef> &DumpFile,
+                                  bool ErrorOnSnippetCrash /*= false*/) const {
   Benchmark &InstrBenchmark = RC.InstrBenchmark;
   object::OwningBinary<object::ObjectFile> &ObjectFile = RC.ObjectFile;
 

diff  --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h 
b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
index 24f2086289408..eb8c9f55722ca 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
@@ -65,9 +65,9 @@ class BenchmarkRunner {
                            unsigned NumRepetitions, unsigned LoopUnrollFactor,
                            const SnippetRepetitor &Repetitor) const;
 
-  Expected<Benchmark>
-  runConfiguration(RunnableConfiguration &&RC,
-                   const std::optional<StringRef> &DumpFile) const;
+  Expected<Benchmark> runConfiguration(RunnableConfiguration &&RC,
+                                       const std::optional<StringRef> 
&DumpFile,
+                                       bool ErrorOnSnippetCrash = false) const;
 
   // Scratch space to run instructions that touch memory.
   struct ScratchSpace {

diff  --git a/llvm/tools/llvm-exegesis/lib/Error.h 
b/llvm/tools/llvm-exegesis/lib/Error.h
index 8d3f394ed8d6e..8c95439d63ac6 100644
--- a/llvm/tools/llvm-exegesis/lib/Error.h
+++ b/llvm/tools/llvm-exegesis/lib/Error.h
@@ -52,6 +52,8 @@ class SnippetCrash : public ErrorInfo<SnippetCrash> {
 
   std::error_code convertToErrorCode() const override;
 
+  intptr_t GetCrashAddress() const { return SIAddress; }
+
 private:
   std::string Msg;
   intptr_t SIAddress;


        
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to