summaryrefslogtreecommitdiff
path: root/libc/benchmarks
diff options
context:
space:
mode:
authorSiva Chandra Reddy <sivachandra@google.com>2022-12-11 00:20:33 +0000
committerSiva Chandra Reddy <sivachandra@google.com>2022-12-11 00:31:21 +0000
commit8dcb7f6b6f7863331a88798415144f0cabc4b59b (patch)
treedd348e3817ece930c77a6b9db8dae432e434c2bf /libc/benchmarks
parentf3400305771d4e0084d2ebc8e3e5d2736ba3bd7c (diff)
downloadllvm-8dcb7f6b6f7863331a88798415144f0cabc4b59b.tar.gz
[libc][Obvious] Fix memory function benchmarks after removal of None.
Diffstat (limited to 'libc/benchmarks')
-rw-r--r--libc/benchmarks/JSON.cpp5
-rw-r--r--libc/benchmarks/LibcMemoryBenchmark.h3
-rw-r--r--libc/benchmarks/LibcMemoryBenchmarkTest.cpp3
3 files changed, 7 insertions, 4 deletions
diff --git a/libc/benchmarks/JSON.cpp b/libc/benchmarks/JSON.cpp
index f2a9d8b27f48..fd5cf4573344 100644
--- a/libc/benchmarks/JSON.cpp
+++ b/libc/benchmarks/JSON.cpp
@@ -21,6 +21,7 @@
#include <chrono>
#include <limits>
#include <memory>
+#include <optional>
#include <string>
#include <vector>
@@ -86,7 +87,7 @@ static Error fromJson(const json::Value &V, MaybeAlign &Out) {
"Can't parse Align, not an Integer");
const int64_t Value = *MaybeInt;
if (!Value) {
- Out = None;
+ Out = std::nullopt;
return Error::success();
}
if (isPowerOf2_64(Value)) {
@@ -108,7 +109,7 @@ static Error fromJson(const json::Value &V,
.Case("None", libc_benchmarks::BenchmarkLog::None)
.Case("Last", libc_benchmarks::BenchmarkLog::Last)
.Case("Full", libc_benchmarks::BenchmarkLog::Full)
- .Default(None);
+ .Default(std::nullopt);
if (!Parsed)
return createStringError(errc::io_error,
Twine("Can't parse BenchmarkLog, invalid value '")
diff --git a/libc/benchmarks/LibcMemoryBenchmark.h b/libc/benchmarks/LibcMemoryBenchmark.h
index b3f0f94cd314..382ff867e36f 100644
--- a/libc/benchmarks/LibcMemoryBenchmark.h
+++ b/libc/benchmarks/LibcMemoryBenchmark.h
@@ -18,6 +18,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Alignment.h"
#include <cstdint>
+#include <optional>
#include <random>
namespace llvm {
@@ -58,7 +59,7 @@ struct StudyConfiguration {
// None : Use a fixed address that is at least cache line aligned,
// 1 : Use random address,
// >1 : Use random address aligned to value.
- MaybeAlign AccessAlignment = None;
+ MaybeAlign AccessAlignment = std::nullopt;
// When Function == 'memcmp', this is the buffers mismatch position.
// 0 : Buffers always compare equal,
diff --git a/libc/benchmarks/LibcMemoryBenchmarkTest.cpp b/libc/benchmarks/LibcMemoryBenchmarkTest.cpp
index 4de521aafeac..00866e5a65c2 100644
--- a/libc/benchmarks/LibcMemoryBenchmarkTest.cpp
+++ b/libc/benchmarks/LibcMemoryBenchmarkTest.cpp
@@ -10,6 +10,7 @@
#include "llvm/Support/Alignment.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
+#include <optional>
using testing::AllOf;
using testing::AnyOf;
@@ -35,7 +36,7 @@ TEST(AlignedBuffer, Empty) {
TEST(OffsetDistribution, AlignToBegin) {
const size_t BufferSize = 8192;
- OffsetDistribution OD(BufferSize, 1024, None);
+ OffsetDistribution OD(BufferSize, 1024, std::nullopt);
std::default_random_engine Gen;
for (size_t I = 0; I <= 10; ++I)
EXPECT_EQ(OD(Gen), 0U);