[libc][Obvious] Fix memory function benchmarks after removal of None.
authorSiva Chandra Reddy <sivachandra@google.com>
Sun, 11 Dec 2022 00:20:33 +0000 (00:20 +0000)
committerSiva Chandra Reddy <sivachandra@google.com>
Sun, 11 Dec 2022 00:31:21 +0000 (00:31 +0000)
libc/benchmarks/JSON.cpp
libc/benchmarks/LibcMemoryBenchmark.h
libc/benchmarks/LibcMemoryBenchmarkTest.cpp

index f2a9d8b..fd5cf45 100644 (file)
@@ -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 '")
index b3f0f94..382ff86 100644 (file)
@@ -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,
index 4de521a..00866e5 100644 (file)
@@ -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);