Skip to content

[llvm-exegesis] Minor changes for downstream consumers #74211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -575,7 +576,7 @@ Expected<Benchmark> BenchmarkRunner::runConfiguration(
auto NewMeasurements = runMeasurements(**Executor);

if (Error E = NewMeasurements.takeError()) {
if (!E.isA<SnippetCrash>())
if (!E.isA<SnippetCrash>() || ErrorOnSnippetCrash)
return std::move(E);
InstrBenchmark.Error = toString(std::move(E));
return std::move(InstrBenchmark);
Expand Down
6 changes: 3 additions & 3 deletions llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions llvm/tools/llvm-exegesis/lib/Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down