summaryrefslogtreecommitdiff
path: root/libc/benchmarks
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-12-09 19:14:05 -0800
committerKazu Hirata <kazu@google.com>2022-12-09 19:14:05 -0800
commit70fe44ca777f179e3de9aa42afc14cd5f86abd34 (patch)
treeef0bfeb59028e019deee2be0c2717dfad50f96b1 /libc/benchmarks
parentf9c76a1198349d08cae6068453ebbaef607f4f6d (diff)
downloadllvm-70fe44ca777f179e3de9aa42afc14cd5f86abd34.tar.gz
[libc] Use std::nullopt instead of None (NFC)
This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Diffstat (limited to 'libc/benchmarks')
-rw-r--r--libc/benchmarks/automemcpy/include/automemcpy/RandomFunctionGenerator.h2
-rw-r--r--libc/benchmarks/automemcpy/lib/CodeGen.cpp6
-rw-r--r--libc/benchmarks/automemcpy/lib/RandomFunctionGenerator.cpp2
-rw-r--r--libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp33
4 files changed, 22 insertions, 21 deletions
diff --git a/libc/benchmarks/automemcpy/include/automemcpy/RandomFunctionGenerator.h b/libc/benchmarks/automemcpy/include/automemcpy/RandomFunctionGenerator.h
index 48e8815801c5..4fa1c3843a0e 100644
--- a/libc/benchmarks/automemcpy/include/automemcpy/RandomFunctionGenerator.h
+++ b/libc/benchmarks/automemcpy/include/automemcpy/RandomFunctionGenerator.h
@@ -26,7 +26,7 @@ namespace automemcpy {
struct RandomFunctionGenerator {
RandomFunctionGenerator();
- // Get the next valid FunctionDescriptor or llvm::None.
+ // Get the next valid FunctionDescriptor or std::nullopt.
Optional<FunctionDescriptor> next();
private:
diff --git a/libc/benchmarks/automemcpy/lib/CodeGen.cpp b/libc/benchmarks/automemcpy/lib/CodeGen.cpp
index cf196b1ad6a7..7f7d2b564b38 100644
--- a/libc/benchmarks/automemcpy/lib/CodeGen.cpp
+++ b/libc/benchmarks/automemcpy/lib/CodeGen.cpp
@@ -310,8 +310,8 @@ namespace descriptors {
// e.g.
// ArrayRef<NamedFunctionDescriptor> getFunctionDescriptors() {
// static constexpr NamedFunctionDescriptor kDescriptors[] = {
-// {"memcpy_0xE00E29EE73994E2B",{FunctionType::MEMCPY,llvm::None,llvm::None,llvm::None,llvm::None,Accelerator{{0,kMaxSize}},ElementTypeClass::NATIVE}},
-// {"memcpy_0x8661D80472487AB5",{FunctionType::MEMCPY,Contiguous{{0,1}},llvm::None,llvm::None,llvm::None,Accelerator{{1,kMaxSize}},ElementTypeClass::NATIVE}},
+// {"memcpy_0xE00E29EE73994E2B",{FunctionType::MEMCPY,std::nullopt,std::nullopt,std::nullopt,std::nullopt,Accelerator{{0,kMaxSize}},ElementTypeClass::NATIVE}},
+// {"memcpy_0x8661D80472487AB5",{FunctionType::MEMCPY,Contiguous{{0,1}},std::nullopt,std::nullopt,std::nullopt,Accelerator{{1,kMaxSize}},ElementTypeClass::NATIVE}},
// ...
// };
// return makeArrayRef(kDescriptors);
@@ -380,7 +380,7 @@ static raw_ostream &operator<<(raw_ostream &Stream,
const llvm::Optional<T> &MaybeT) {
if (MaybeT)
return Stream << *MaybeT;
- return Stream << "llvm::None";
+ return Stream << "std::nullopt";
}
static raw_ostream &operator<<(raw_ostream &Stream,
const FunctionDescriptor &FD) {
diff --git a/libc/benchmarks/automemcpy/lib/RandomFunctionGenerator.cpp b/libc/benchmarks/automemcpy/lib/RandomFunctionGenerator.cpp
index 763fbc6d85a3..c8ceecc0d609 100644
--- a/libc/benchmarks/automemcpy/lib/RandomFunctionGenerator.cpp
+++ b/libc/benchmarks/automemcpy/lib/RandomFunctionGenerator.cpp
@@ -156,7 +156,7 @@ RandomFunctionGenerator::RandomFunctionGenerator()
}
// Creates SizeSpan from Begin/End values.
-// Returns llvm::None if Begin==End.
+// Returns std::nullopt if Begin==End.
static Optional<SizeSpan> AsSizeSpan(size_t Begin, size_t End) {
if (Begin == End)
return None;
diff --git a/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp b/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp
index ef16a61c6320..1d8df111f600 100644
--- a/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp
+++ b/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp
@@ -10,6 +10,7 @@
#include "automemcpy/RandomFunctionGenerator.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
+#include <optional>
using testing::AllOf;
using testing::AnyOf;
@@ -25,22 +26,22 @@ namespace {
TEST(Automemcpy, Codegen) {
static constexpr FunctionDescriptor kDescriptors[] = {
- {FunctionType::MEMCPY, llvm::None, llvm::None, llvm::None, llvm::None,
+ {FunctionType::MEMCPY, std::nullopt, std::nullopt, std::nullopt, std::nullopt,
Accelerator{{0, kMaxSize}}, ElementTypeClass::NATIVE},
{FunctionType::MEMCPY, Contiguous{{0, 4}}, Overlap{{4, 256}},
- Loop{{256, kMaxSize}, 64}, llvm::None, llvm::None,
+ Loop{{256, kMaxSize}, 64}, std::nullopt, std::nullopt,
ElementTypeClass::NATIVE},
- {FunctionType::MEMCMP, Contiguous{{0, 2}}, Overlap{{2, 64}}, llvm::None,
- AlignedLoop{Loop{{64, kMaxSize}, 16}, 16, AlignArg::_1}, llvm::None,
+ {FunctionType::MEMCMP, Contiguous{{0, 2}}, Overlap{{2, 64}}, std::nullopt,
+ AlignedLoop{Loop{{64, kMaxSize}, 16}, 16, AlignArg::_1}, std::nullopt,
ElementTypeClass::NATIVE},
- {FunctionType::MEMSET, Contiguous{{0, 2}}, Overlap{{2, 256}}, llvm::None,
- AlignedLoop{Loop{{256, kMaxSize}, 32}, 16, AlignArg::_1}, llvm::None,
+ {FunctionType::MEMSET, Contiguous{{0, 2}}, Overlap{{2, 256}}, std::nullopt,
+ AlignedLoop{Loop{{256, kMaxSize}, 32}, 16, AlignArg::_1}, std::nullopt,
ElementTypeClass::NATIVE},
- {FunctionType::MEMSET, Contiguous{{0, 2}}, Overlap{{2, 256}}, llvm::None,
- AlignedLoop{Loop{{256, kMaxSize}, 32}, 32, AlignArg::_1}, llvm::None,
+ {FunctionType::MEMSET, Contiguous{{0, 2}}, Overlap{{2, 256}}, std::nullopt,
+ AlignedLoop{Loop{{256, kMaxSize}, 32}, 32, AlignArg::_1}, std::nullopt,
ElementTypeClass::NATIVE},
- {FunctionType::BZERO, Contiguous{{0, 4}}, Overlap{{4, 128}}, llvm::None,
- AlignedLoop{Loop{{128, kMaxSize}, 32}, 32, AlignArg::_1}, llvm::None,
+ {FunctionType::BZERO, Contiguous{{0, 4}}, Overlap{{4, 128}}, std::nullopt,
+ AlignedLoop{Loop{{128, kMaxSize}, 32}, 32, AlignArg::_1}, std::nullopt,
ElementTypeClass::NATIVE},
};
@@ -140,12 +141,12 @@ namespace automemcpy {
ArrayRef<NamedFunctionDescriptor> getFunctionDescriptors() {
static constexpr NamedFunctionDescriptor kDescriptors[] = {
- {"memcpy_0xE00E29EE73994E2B",{FunctionType::MEMCPY,llvm::None,llvm::None,llvm::None,llvm::None,Accelerator{{0,kMaxSize}},ElementTypeClass::NATIVE}},
- {"memcpy_0x7381B60C7BE75EF9",{FunctionType::MEMCPY,Contiguous{{0,4}},Overlap{{4,256}},Loop{{256,kMaxSize},64},llvm::None,llvm::None,ElementTypeClass::NATIVE}},
- {"memcmp_0x348D7BA6DB0EE033",{FunctionType::MEMCMP,Contiguous{{0,2}},Overlap{{2,64}},llvm::None,AlignedLoop{Loop{{64,kMaxSize},16},16,AlignArg::_1},llvm::None,ElementTypeClass::NATIVE}},
- {"memset_0x71E761699B999863",{FunctionType::MEMSET,Contiguous{{0,2}},Overlap{{2,256}},llvm::None,AlignedLoop{Loop{{256,kMaxSize},32},16,AlignArg::_1},llvm::None,ElementTypeClass::NATIVE}},
- {"memset_0x3DF0F44E2ED6A50F",{FunctionType::MEMSET,Contiguous{{0,2}},Overlap{{2,256}},llvm::None,AlignedLoop{Loop{{256,kMaxSize},32},32,AlignArg::_1},llvm::None,ElementTypeClass::NATIVE}},
- {"bzero_0x475977492C218AD4",{FunctionType::BZERO,Contiguous{{0,4}},Overlap{{4,128}},llvm::None,AlignedLoop{Loop{{128,kMaxSize},32},32,AlignArg::_1},llvm::None,ElementTypeClass::NATIVE}},
+ {"memcpy_0xE00E29EE73994E2B",{FunctionType::MEMCPY,std::nullopt,std::nullopt,std::nullopt,std::nullopt,Accelerator{{0,kMaxSize}},ElementTypeClass::NATIVE}},
+ {"memcpy_0x7381B60C7BE75EF9",{FunctionType::MEMCPY,Contiguous{{0,4}},Overlap{{4,256}},Loop{{256,kMaxSize},64},std::nullopt,std::nullopt,ElementTypeClass::NATIVE}},
+ {"memcmp_0x348D7BA6DB0EE033",{FunctionType::MEMCMP,Contiguous{{0,2}},Overlap{{2,64}},std::nullopt,AlignedLoop{Loop{{64,kMaxSize},16},16,AlignArg::_1},std::nullopt,ElementTypeClass::NATIVE}},
+ {"memset_0x71E761699B999863",{FunctionType::MEMSET,Contiguous{{0,2}},Overlap{{2,256}},std::nullopt,AlignedLoop{Loop{{256,kMaxSize},32},16,AlignArg::_1},std::nullopt,ElementTypeClass::NATIVE}},
+ {"memset_0x3DF0F44E2ED6A50F",{FunctionType::MEMSET,Contiguous{{0,2}},Overlap{{2,256}},std::nullopt,AlignedLoop{Loop{{256,kMaxSize},32},32,AlignArg::_1},std::nullopt,ElementTypeClass::NATIVE}},
+ {"bzero_0x475977492C218AD4",{FunctionType::BZERO,Contiguous{{0,4}},Overlap{{4,128}},std::nullopt,AlignedLoop{Loop{{128,kMaxSize},32},32,AlignArg::_1},std::nullopt,ElementTypeClass::NATIVE}},
};
return makeArrayRef(kDescriptors);
}