diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp index dee7af5fd520a..87e2b768d5e63 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include #include #include @@ -615,9 +616,9 @@ std::pair BenchmarkRunner::runConfiguration( // Scale the measurements by instruction. BM.PerInstructionValue /= BenchmarkResult.NumRepetitions; // Scale the measurements by snippet. - BM.PerSnippetValue *= - static_cast(BenchmarkResult.Key.Instructions.size()) / - BenchmarkResult.NumRepetitions; + BM.PerSnippetValue /= + std::ceil(BenchmarkResult.NumRepetitions / + static_cast(BenchmarkResult.Key.Instructions.size())); } BenchmarkResult.Measurements = std::move(*NewMeasurements);