aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SelectOptimize.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-11-21 19:06:42 -0800
committerKazu Hirata <kazu@google.com>2022-11-21 19:06:42 -0800
commit6ba4b62af8df00edb7e1cc0c473f6770fb1cfe3b (patch)
tree8f6741f9b0cdd8b892c83c78614e861d9ec325ad /llvm/lib/CodeGen/SelectOptimize.cpp
parent1f914944b6c9a5e4229ceb9f06140fdf178c5ea0 (diff)
downloadllvm-6ba4b62af8df00edb7e1cc0c473f6770fb1cfe3b.zip
llvm-6ba4b62af8df00edb7e1cc0c473f6770fb1cfe3b.tar.gz
llvm-6ba4b62af8df00edb7e1cc0c473f6770fb1cfe3b.tar.bz2
Return None instead of Optional<T>() (NFC)
This patch replaces: return Optional<T>(); with: return None; to make the migration from llvm::Optional to std::optional easier. Specifically, I can deprecate None (in my source tree, that is) to identify all the instances of None that should be replaced with std::nullopt. Note that "return None" far outnumbers "return Optional<T>();". There are more than 2000 instances of "return None" in our source tree. All of the instances in this patch come from functions that return Optional<T> except Archive::findSym and ASTNodeImporter::import, where we return Expected<Optional<T>>. Note that we can construct Expected<Optional<T>> from any parameter convertible to Optional<T>, which None certainly is. 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 Differential Revision: https://reviews.llvm.org/D138464
Diffstat (limited to 'llvm/lib/CodeGen/SelectOptimize.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectOptimize.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectOptimize.cpp b/llvm/lib/CodeGen/SelectOptimize.cpp
index 3fdf1fc..ca46e8a 100644
--- a/llvm/lib/CodeGen/SelectOptimize.cpp
+++ b/llvm/lib/CodeGen/SelectOptimize.cpp
@@ -949,7 +949,7 @@ Optional<uint64_t> SelectOptimize::computeInstCost(const Instruction *I) {
TTI->getInstructionCost(I, TargetTransformInfo::TCK_Latency);
if (auto OC = ICost.getValue())
return Optional<uint64_t>(*OC);
- return Optional<uint64_t>();
+ return None;
}
ScaledNumber<uint64_t>