aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUtils.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-12-02 21:11:37 -0800
committerKazu Hirata <kazu@google.com>2022-12-02 21:11:37 -0800
commit343de6856e16b58bcbd16d479fc633f54e22fadc (patch)
tree31e3fbef03aa0e4c5ea9582d0eacc650aba3073d /llvm/lib/Transforms/Utils/LoopUtils.cpp
parent998960ee1f2c8bc3830df4849ab89ec9d6217f26 (diff)
downloadllvm-343de6856e16b58bcbd16d479fc633f54e22fadc.zip
llvm-343de6856e16b58bcbd16d479fc633f54e22fadc.tar.gz
llvm-343de6856e16b58bcbd16d479fc633f54e22fadc.tar.bz2
[Transforms] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. 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 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUtils.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index b69735a..9ada3a2d 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -258,7 +258,7 @@ llvm::getOptionalElementCountLoopAttribute(const Loop *TheLoop) {
return ElementCount::get(*Width, IsScalable.value_or(false));
}
- return None;
+ return std::nullopt;
}
Optional<MDNode *> llvm::makeFollowupLoopID(
@@ -267,7 +267,7 @@ Optional<MDNode *> llvm::makeFollowupLoopID(
if (!OrigLoopID) {
if (AlwaysNew)
return nullptr;
- return None;
+ return std::nullopt;
}
assert(OrigLoopID->getOperand(0) == OrigLoopID);
@@ -326,7 +326,7 @@ Optional<MDNode *> llvm::makeFollowupLoopID(
// Attributes of the followup loop not specified explicity, so signal to the
// transformation pass to add suitable attributes.
if (!AlwaysNew && !HasAnyFollowup)
- return None;
+ return std::nullopt;
// If no attributes were added or remove, the previous loop Id can be reused.
if (!AlwaysNew && !Changed)
@@ -790,14 +790,14 @@ getEstimatedTripCount(BranchInst *ExitingBranch, Loop *L,
// we exited the loop.
uint64_t LoopWeight, ExitWeight;
if (!extractBranchWeights(*ExitingBranch, LoopWeight, ExitWeight))
- return None;
+ return std::nullopt;
if (L->contains(ExitingBranch->getSuccessor(1)))
std::swap(LoopWeight, ExitWeight);
if (!ExitWeight)
// Don't have a way to return predicated infinite
- return None;
+ return std::nullopt;
OrigExitWeight = ExitWeight;
@@ -824,7 +824,7 @@ llvm::getLoopEstimatedTripCount(Loop *L,
return *EstTripCount;
}
}
- return None;
+ return std::nullopt;
}
bool llvm::setLoopEstimatedTripCount(Loop *L, unsigned EstimatedTripCount,