[llvm] f95ddf0 - [llvm-exegesis] Benchmark: gracefully handle lack of configurations to run

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 18 09:07:23 PST 2022


Author: Roman Lebedev
Date: 2022-12-18T20:07:02+03:00
New Revision: f95ddf0ee7377f6677461b791199c6ffdb489027

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

LOG: [llvm-exegesis] Benchmark: gracefully handle lack of configurations to run

Otherwise the progress meter would assert.

Added: 
    llvm/test/tools/llvm-exegesis/X86/latency/latency-SYSENTER.s

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-exegesis/X86/latency/latency-SYSENTER.s b/llvm/test/tools/llvm-exegesis/X86/latency/latency-SYSENTER.s
new file mode 100644
index 000000000000..b82b0bf10c45
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/X86/latency/latency-SYSENTER.s
@@ -0,0 +1,4 @@
+# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SYSENTER -repetition-mode=duplicate 2>&1 | FileCheck %s
+# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SYSENTER -repetition-mode=loop 2>&1 | FileCheck %s
+
+CHECK: SYSENTER: unsupported opcode

diff  --git a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
index 459e9800f083..6a9e475cadb2 100644
--- a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
+++ b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
@@ -321,6 +321,7 @@ static void runBenchmarkConfigurations(
     const LLVMState &State, ArrayRef<BenchmarkCode> Configurations,
     ArrayRef<std::unique_ptr<const SnippetRepetitor>> Repetitors,
     const BenchmarkRunner &Runner) {
+  assert(!Configurations.empty() && "Don't have any configurations to run.");
   std::optional<raw_fd_ostream> FileOstr;
   if (BenchmarkFile != "-") {
     int ResultFD = 0;
@@ -468,7 +469,8 @@ void benchmarkMain() {
   if (BenchmarkFile.empty())
     BenchmarkFile = "-";
 
-  runBenchmarkConfigurations(State, Configurations, Repetitors, *Runner);
+  if (!Configurations.empty())
+    runBenchmarkConfigurations(State, Configurations, Repetitors, *Runner);
 
   exegesis::pfm::pfmTerminate();
 }


        


More information about the llvm-commits mailing list