aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
diff options
context:
space:
mode:
authorAiden Grossman <agrossman154@yahoo.com>2024-02-01 01:58:27 -0800
committerGitHub <noreply@github.com>2024-02-01 01:58:27 -0800
commit415bf200a725055a3a38e96269f4b752ea6fc330 (patch)
tree0f42987c412ae652419f7c857abd851d1361a277 /llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
parent395c8175e37248c11ddbffe47294033834b0ec51 (diff)
downloadllvm-415bf200a725055a3a38e96269f4b752ea6fc330.zip
llvm-415bf200a725055a3a38e96269f4b752ea6fc330.tar.gz
llvm-415bf200a725055a3a38e96269f4b752ea6fc330.tar.bz2
[llvm-exegesis] Replace --num-repetitions with --min-instructions (#77153)
This patch replaces --num-repetitions with --min-instructions to make it more clear that the value refers to the minimum number of instructions in the final assembled snippet rather than the number of repetitions of the snippet. This patch also refactors some llvm-exegesis internal variable names to reflect the name change. Fixes #76890.
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp')
-rw-r--r--llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
index e985c32..c193a8e 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
@@ -355,7 +355,17 @@ struct MappingContextTraits<exegesis::Benchmark, YamlContext> {
Io.mapRequired("key", Obj.Key, Context);
Io.mapRequired("cpu_name", Obj.CpuName);
Io.mapRequired("llvm_triple", Obj.LLVMTriple);
- Io.mapRequired("num_repetitions", Obj.NumRepetitions);
+ // Optionally map num_repetitions and min_instructions to the same
+ // value to preserve backwards compatibility.
+ // TODO(boomanaiden154): Move min_instructions to mapRequired and
+ // remove num_repetitions once num_repetitions is ready to be removed
+ // completely.
+ if (Io.outputting())
+ Io.mapRequired("min_instructions", Obj.MinInstructions);
+ else {
+ Io.mapOptional("num_repetitions", Obj.MinInstructions);
+ Io.mapOptional("min_instructions", Obj.MinInstructions);
+ }
Io.mapRequired("measurements", Obj.Measurements);
Io.mapRequired("error", Obj.Error);
Io.mapOptional("info", Obj.Info);