[llvm] 3c09ed0 - [llvm] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 4 17:12:51 PST 2022
Author: Kazu Hirata
Date: 2022-12-04T17:12:44-08:00
New Revision: 3c09ed006ab35dd8faac03311b14f0857b01949c
URL: https://github.com/llvm/llvm-project/commit/3c09ed006ab35dd8faac03311b14f0857b01949c
DIFF: https://github.com/llvm/llvm-project/commit/3c09ed006ab35dd8faac03311b14f0857b01949c.diff
LOG: [llvm] Use std::nullopt instead of None in comments (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
Added:
Modified:
llvm/include/llvm/ADT/APInt.h
llvm/include/llvm/ADT/Optional.h
llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
llvm/include/llvm/Analysis/InlineCost.h
llvm/include/llvm/Analysis/LoopAccessAnalysis.h
llvm/include/llvm/Analysis/ObjCARCUtil.h
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/include/llvm/Analysis/ValueTracking.h
llvm/include/llvm/Bitstream/BitstreamReader.h
llvm/include/llvm/CodeGen/GlobalISel/Utils.h
llvm/include/llvm/ExecutionEngine/RuntimeDyld.h
llvm/include/llvm/IR/ConstantRange.h
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/include/llvm/IR/GlobalValue.h
llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
llvm/include/llvm/Support/JSON.h
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Analysis/MemorySSA.cpp
llvm/lib/Analysis/ProfileSummaryInfo.cpp
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/lib/Analysis/VFABIDemangling.cpp
llvm/lib/Analysis/ValueTracking.cpp
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
llvm/lib/Object/MachOObjectFile.cpp
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
llvm/lib/Target/AArch64/AArch64InstrInfo.h
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/lib/Transforms/IPO/IROutliner.cpp
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
llvm/lib/Transforms/Scalar/LoopPredication.cpp
llvm/lib/Transforms/Utils/ValueMapper.cpp
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
llvm/unittests/IR/MetadataTest.cpp
llvm/unittests/Support/DataExtractorTest.cpp
llvm/utils/TableGen/GlobalISelEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 2e2f9ef4d1207..ac9482b094d09 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -2234,7 +2234,7 @@ APInt RoundingSDiv(const APInt &A, const APInt &B, APInt::Rounding RM);
/// value to go from [-2^BW, 0) to [0, 2^BW). In that sense, zero is
/// treated as a special case of an overflow.
///
-/// This function returns None if after finding k that minimizes the
+/// This function returns std::nullopt if after finding k that minimizes the
/// positive solution to q(n) = kR, both solutions are contained between
/// two consecutive integers.
///
diff --git a/llvm/include/llvm/ADT/Optional.h b/llvm/include/llvm/ADT/Optional.h
index f666f522f0022..56c0d9c29bf43 100644
--- a/llvm/include/llvm/ADT/Optional.h
+++ b/llvm/include/llvm/ADT/Optional.h
@@ -293,7 +293,7 @@ template <typename T> class Optional {
return has_value() ? value() : std::forward<U>(alt);
}
- /// Apply a function to the value if present; otherwise return None.
+ /// Apply a function to the value if present; otherwise return std::nullopt.
template <class Function>
auto transform(const Function &F) const & -> Optional<decltype(F(value()))> {
if (*this)
@@ -308,7 +308,7 @@ template <typename T> class Optional {
return has_value() ? std::move(value()) : std::forward<U>(alt);
}
- /// Apply a function to the value if present; otherwise return None.
+ /// Apply a function to the value if present; otherwise return std::nullopt.
template <class Function>
auto transform(
const Function &F) && -> Optional<decltype(F(std::move(*this).value()))> {
diff --git a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
index 4bfdda247c52d..d7464b677b9aa 100644
--- a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
+++ b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
@@ -888,7 +888,7 @@ class IRSimilarityCandidate {
/// Finds the positive number associated with \p V if it has been mapped.
/// \param [in] V - the Value to find.
/// \returns The positive number corresponding to the value.
- /// \returns None if not present.
+ /// \returns std::nullopt if not present.
Optional<unsigned> getGVN(Value *V) {
assert(V != nullptr && "Value is a nullptr?");
DenseMap<Value *, unsigned>::iterator VNIt = ValueToNumber.find(V);
@@ -900,7 +900,7 @@ class IRSimilarityCandidate {
/// Finds the Value associate with \p Num if it exists.
/// \param [in] Num - the number to find.
/// \returns The Value associated with the number.
- /// \returns None if not present.
+ /// \returns std::nullopt if not present.
Optional<Value *> fromGVN(unsigned Num) {
DenseMap<unsigned, Value *>::iterator VNIt = NumberToValue.find(Num);
if (VNIt == NumberToValue.end())
diff --git a/llvm/include/llvm/Analysis/InlineCost.h b/llvm/include/llvm/Analysis/InlineCost.h
index 3f246cc3ea5be..cef704bb783ff 100644
--- a/llvm/include/llvm/Analysis/InlineCost.h
+++ b/llvm/include/llvm/Analysis/InlineCost.h
@@ -300,8 +300,8 @@ getInlineCost(CallBase &Call, Function *Callee, const InlineParams &Params,
/// because of user directives, and the inlining is viable. Returns
/// InlineResult::failure() if the inlining may never happen because of user
/// directives or incompatibilities detectable without needing callee traversal.
-/// Otherwise returns None, meaning that inlining should be decided based on
-/// other criteria (e.g. cost modeling).
+/// Otherwise returns std::nullopt, meaning that inlining should be decided
+/// based on other criteria (e.g. cost modeling).
Optional<InlineResult> getAttributeBasedInliningDecision(
CallBase &Call, Function *Callee, TargetTransformInfo &CalleeTTI,
function_ref<const TargetLibraryInfo &(Function &)> GetTLI);
diff --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
index c57904ebc8171..ee5e3f74b41ca 100644
--- a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -721,7 +721,7 @@ const SCEV *replaceSymbolicStrideSCEV(PredicatedScalarEvolution &PSE,
Value *Ptr);
/// If the pointer has a constant stride return it in units of the access type
-/// size. Otherwise return None.
+/// size. Otherwise return std::nullopt.
///
/// Ensure that it does not wrap in the address space, assuming the predicate
/// associated with \p PSE is true.
diff --git a/llvm/include/llvm/Analysis/ObjCARCUtil.h b/llvm/include/llvm/Analysis/ObjCARCUtil.h
index 913fb3e428f57..7e27e9aec73f5 100644
--- a/llvm/include/llvm/Analysis/ObjCARCUtil.h
+++ b/llvm/include/llvm/Analysis/ObjCARCUtil.h
@@ -54,9 +54,9 @@ inline bool isRetainOrClaimRV(ARCInstKind Kind) {
}
/// This function returns the ARCInstKind of the function attached to operand
-/// bundle clang_arc_attachedcall. It returns None if the call doesn't have the
-/// operand bundle or the operand is null. Otherwise it returns either RetainRV
-/// or UnsafeClaimRV.
+/// bundle clang_arc_attachedcall. It returns std::nullopt if the call doesn't
+/// have the operand bundle or the operand is null. Otherwise it returns either
+/// RetainRV or UnsafeClaimRV.
inline ARCInstKind getAttachedARCFunctionKind(const CallBase *CB) {
Optional<Function *> Fn = getAttachedARCFunction(CB);
if (!Fn)
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index a180cf5783dbf..6a2dbf79de7ac 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -1046,7 +1046,7 @@ class ScalarEvolution {
/// Check whether the condition described by Pred, LHS, and RHS is true or
/// false. If we know it, return the evaluation of this condition. If neither
- /// is proved, return None.
+ /// is proved, return std::nullopt.
Optional<bool> evaluatePredicate(ICmpInst::Predicate Pred, const SCEV *LHS,
const SCEV *RHS);
@@ -1057,7 +1057,7 @@ class ScalarEvolution {
/// Check whether the condition described by Pred, LHS, and RHS is true or
/// false in the given \p Context. If we know it, return the evaluation of
- /// this condition. If neither is proved, return None.
+ /// this condition. If neither is proved, return std::nullopt.
Optional<bool> evaluatePredicateAt(ICmpInst::Predicate Pred, const SCEV *LHS,
const SCEV *RHS, const Instruction *CtxI);
@@ -1079,7 +1079,8 @@ class ScalarEvolution {
/// If, for all loop invariant X, the predicate "LHS `Pred` X" is
/// monotonically increasing or decreasing, returns
/// Some(MonotonicallyIncreasing) and Some(MonotonicallyDecreasing)
- /// respectively. If we could not prove either of these facts, returns None.
+ /// respectively. If we could not prove either of these facts, returns
+ /// std::nullopt.
Optional<MonotonicPredicateType>
getMonotonicPredicateType(const SCEVAddRecExpr *LHS,
ICmpInst::Predicate Pred);
@@ -1095,7 +1096,7 @@ class ScalarEvolution {
};
/// If the result of the predicate LHS `Pred` RHS is loop invariant with
/// respect to L, return a LoopInvariantPredicate with LHS and RHS being
- /// invariants, available at L's entry. Otherwise, return None.
+ /// invariants, available at L's entry. Otherwise, return std::nullopt.
Optional<LoopInvariantPredicate>
getLoopInvariantPredicate(ICmpInst::Predicate Pred, const SCEV *LHS,
const SCEV *RHS, const Loop *L,
@@ -1104,8 +1105,8 @@ class ScalarEvolution {
/// If the result of the predicate LHS `Pred` RHS is loop invariant with
/// respect to L at given Context during at least first MaxIter iterations,
/// return a LoopInvariantPredicate with LHS and RHS being invariants,
- /// available at L's entry. Otherwise, return None. The predicate should be
- /// the loop's exit condition.
+ /// available at L's entry. Otherwise, return std::nullopt. The predicate
+ /// should be the loop's exit condition.
Optional<LoopInvariantPredicate>
getLoopInvariantExitCondDuringFirstIterations(ICmpInst::Predicate Pred,
const SCEV *LHS,
diff --git a/llvm/include/llvm/Analysis/ValueTracking.h b/llvm/include/llvm/Analysis/ValueTracking.h
index 8bef5925e3362..fa675bbf2e10e 100644
--- a/llvm/include/llvm/Analysis/ValueTracking.h
+++ b/llvm/include/llvm/Analysis/ValueTracking.h
@@ -813,10 +813,10 @@ bool matchSimpleRecurrence(const BinaryOperator *I, PHINode *&P, Value *&Start,
Value *&Step);
/// Return true if RHS is known to be implied true by LHS. Return false if
-/// RHS is known to be implied false by LHS. Otherwise, return None if no
-/// implication can be made.
-/// A & B must be i1 (boolean) values or a vector of such values. Note that
-/// the truth table for implication is the same as <=u on i1 values (but not
+/// RHS is known to be implied false by LHS. Otherwise, return std::nullopt if
+/// no implication can be made. A & B must be i1 (boolean) values or a vector of
+/// such values. Note that the truth table for implication is the same as <=u on
+/// i1 values (but not
/// <=s!). The truth table for both is:
/// | T | F (B)
/// T | T | F
diff --git a/llvm/include/llvm/Bitstream/BitstreamReader.h b/llvm/include/llvm/Bitstream/BitstreamReader.h
index 420a9e98bb8a1..661dc7a871139 100644
--- a/llvm/include/llvm/Bitstream/BitstreamReader.h
+++ b/llvm/include/llvm/Bitstream/BitstreamReader.h
@@ -560,7 +560,7 @@ class BitstreamCursor : SimpleBitstreamCursor {
Error ReadAbbrevRecord();
/// Read and return a block info block from the bitstream. If an error was
- /// encountered, return None.
+ /// encountered, return std::nullopt.
///
/// \param ReadBlockInfoNames Whether to read block/record name information in
/// the BlockInfo block. Only llvm-bcanalyzer uses this.
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/Utils.h b/llvm/include/llvm/CodeGen/GlobalISel/Utils.h
index 75d2c6d1fdd9f..213891c149643 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/Utils.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/Utils.h
@@ -369,7 +369,7 @@ class RegOrConstant {
};
/// \returns The splat index of a G_SHUFFLE_VECTOR \p MI when \p MI is a splat.
-/// If \p MI is not a splat, returns None.
+/// If \p MI is not a splat, returns std::nullopt.
Optional<int> getSplatIndex(MachineInstr &MI);
/// \returns the scalar integral splat value of \p Reg if possible.
diff --git a/llvm/include/llvm/ExecutionEngine/RuntimeDyld.h b/llvm/include/llvm/ExecutionEngine/RuntimeDyld.h
index c434b45077a36..e7895e331bd84 100644
--- a/llvm/include/llvm/ExecutionEngine/RuntimeDyld.h
+++ b/llvm/include/llvm/ExecutionEngine/RuntimeDyld.h
@@ -231,7 +231,7 @@ class RuntimeDyld {
StringRef getSectionContent(unsigned SectionID) const;
/// If the section was loaded, return the section's load address,
- /// otherwise return None.
+ /// otherwise return std::nullopt.
uint64_t getSectionLoadAddress(unsigned SectionID) const;
/// Set the NotifyStubEmitted callback. This is used for debugging
diff --git a/llvm/include/llvm/IR/ConstantRange.h b/llvm/include/llvm/IR/ConstantRange.h
index d2ff971485b38..4bbc8407b5241 100644
--- a/llvm/include/llvm/IR/ConstantRange.h
+++ b/llvm/include/llvm/IR/ConstantRange.h
@@ -333,11 +333,11 @@ class [[nodiscard]] ConstantRange {
PreferredRangeType Type = Smallest) const;
/// Intersect the two ranges and return the result if it can be represented
- /// exactly, otherwise return None.
+ /// exactly, otherwise return std::nullopt.
Optional<ConstantRange> exactIntersectWith(const ConstantRange &CR) const;
/// Union the two ranges and return the result if it can be represented
- /// exactly, otherwise return None.
+ /// exactly, otherwise return std::nullopt.
Optional<ConstantRange> exactUnionWith(const ConstantRange &CR) const;
/// Return a new range representing the possible values resulting
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index 9aef251613aa9..e6bfea5f124b9 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -1728,7 +1728,7 @@ class DILocation : public MDNode {
/// Returns a new DILocation with updated base discriminator \p BD. Only the
/// base discriminator is set in the new DILocation, the other encoded values
/// are elided.
- /// If the discriminator cannot be encoded, the function returns None.
+ /// If the discriminator cannot be encoded, the function returns std::nullopt.
inline std::optional<const DILocation *>
cloneWithBaseDiscriminator(unsigned BD) const;
diff --git a/llvm/include/llvm/IR/GlobalValue.h b/llvm/include/llvm/IR/GlobalValue.h
index 04352193ec438..f92e1a324dad4 100644
--- a/llvm/include/llvm/IR/GlobalValue.h
+++ b/llvm/include/llvm/IR/GlobalValue.h
@@ -638,7 +638,7 @@ class GlobalValue : public Constant {
bool isAbsoluteSymbolRef() const;
/// If this is an absolute symbol reference, returns the range of the symbol,
- /// otherwise returns None.
+ /// otherwise returns std::nullopt.
Optional<ConstantRange> getAbsoluteSymbolRange() const;
/// This method unlinks 'this' from the containing module, but does not delete
diff --git a/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h b/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
index 82a1847ac9be2..55cba3c3bae96 100644
--- a/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
+++ b/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
@@ -141,8 +141,8 @@ class MCDisassembler {
/// start of a symbol, or the entire symbol.
/// This is used for example by WebAssembly to decode preludes.
///
- /// Base implementation returns None. So all targets by default ignore to
- /// treat symbols separately.
+ /// Base implementation returns std::nullopt. So all targets by default ignore
+ /// to treat symbols separately.
///
/// \param Symbol - The symbol.
/// \param Size - The number of bytes consumed.
diff --git a/llvm/include/llvm/Support/JSON.h b/llvm/include/llvm/Support/JSON.h
index 0d07cad2fa8f0..47b2a2fbe0823 100644
--- a/llvm/include/llvm/Support/JSON.h
+++ b/llvm/include/llvm/Support/JSON.h
@@ -135,7 +135,7 @@ class Object {
// Look up a property, returning nullptr if it doesn't exist.
Value *get(StringRef K);
const Value *get(StringRef K) const;
- // Typed accessors return None/nullptr if
+ // Typed accessors return std::nullopt/nullptr if
// - the property doesn't exist
// - or it has the wrong type
llvm::Optional<std::nullptr_t> getNull(StringRef K) const;
@@ -400,7 +400,8 @@ class Value {
llvm_unreachable("Unknown kind");
}
- // Typed accessors return None/nullptr if the Value is not of this type.
+ // Typed accessors return std::nullopt/nullptr if the Value is not of this
+ // type.
llvm::Optional<std::nullptr_t> getAsNull() const {
if (LLVM_LIKELY(Type == T_Null))
return nullptr;
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 0d02993d1f26b..648bdd0750c72 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -1744,7 +1744,7 @@ struct Attributor {
}
/// If \p IRP is assumed to be a constant, return it, if it is unclear yet,
- /// return None, otherwise return `nullptr`.
+ /// return std::nullopt, otherwise return `nullptr`.
Optional<Constant *> getAssumedConstant(const IRPosition &IRP,
const AbstractAttribute &AA,
bool &UsedAssumedInformation);
@@ -1755,7 +1755,7 @@ struct Attributor {
}
/// If \p V is assumed simplified, return it, if it is unclear yet,
- /// return None, otherwise return `nullptr`.
+ /// return std::nullopt, otherwise return `nullptr`.
Optional<Value *> getAssumedSimplified(const IRPosition &IRP,
const AbstractAttribute &AA,
bool &UsedAssumedInformation,
@@ -1771,8 +1771,9 @@ struct Attributor {
}
/// If \p V is assumed simplified, return it, if it is unclear yet,
- /// return None, otherwise return `nullptr`. Same as the public version
- /// except that it can be used without recording dependences on any \p AA.
+ /// return std::nullopt, otherwise return `nullptr`. Same as the public
+ /// version except that it can be used without recording dependences on any \p
+ /// AA.
Optional<Value *> getAssumedSimplified(const IRPosition &V,
const AbstractAttribute *AA,
bool &UsedAssumedInformation,
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp
index c308005b3cf3a..c729f0ab30774 100644
--- a/llvm/lib/Analysis/MemorySSA.cpp
+++ b/llvm/lib/Analysis/MemorySSA.cpp
@@ -621,8 +621,9 @@ template <class AliasAnalysisType> class ClobberWalker {
/// value is the indices of searches that stopped at the last phi optimization
/// target. It's left in an unspecified state.
///
- /// If this returns None, NewPaused is a vector of searches that terminated
- /// at StopWhere. Otherwise, NewPaused is left in an unspecified state.
+ /// If this returns std::nullopt, NewPaused is a vector of searches that
+ /// terminated at StopWhere. Otherwise, NewPaused is left in an unspecified
+ /// state.
Optional<TerminatedPath>
getBlockingAccess(const MemoryAccess *StopWhere,
SmallVectorImpl<ListIndex> &PausedSearches,
diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp
index 31ee8137f5862..f48698a0e54f4 100644
--- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp
+++ b/llvm/lib/Analysis/ProfileSummaryInfo.cpp
@@ -83,7 +83,7 @@ Optional<uint64_t> ProfileSummaryInfo::getProfileCount(
// In sample PGO mode, check if there is a profile metadata on the
// instruction. If it is present, determine hotness solely based on that,
// since the sampled entry count may not be accurate. If there is no
- // annotated on the instruction, return None.
+ // annotated on the instruction, return std::nullopt.
uint64_t TotalCount;
if (Call.extractProfTotalWeight(TotalCount))
return TotalCount;
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index ad48de1755a3a..54542fabea00f 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -712,8 +712,8 @@ CompareValueComplexity(EquivalenceClasses<const Value *> &EqCacheValue,
// Return negative, zero, or positive, if LHS is less than, equal to, or greater
// than RHS, respectively. A three-way result allows recursive comparisons to be
// more efficient.
-// If the max analysis depth was reached, return None, assuming we do not know
-// if they are equivalent for sure.
+// If the max analysis depth was reached, return std::nullopt, assuming we do
+// not know if they are equivalent for sure.
static std::optional<int>
CompareSCEVComplexity(EquivalenceClasses<const SCEV *> &EqCacheSCEV,
EquivalenceClasses<const Value *> &EqCacheValue,
@@ -10005,8 +10005,8 @@ static const SCEV *SolveLinEquationWithOverflow(const APInt &A, const SCEV *B,
/// Ax^2 + Bx + C is the quadratic function, M is the value that A, B and C
/// were multiplied by, and BitWidth is the bit width of the original addrec
/// coefficients.
-/// This function returns None if the addrec coefficients are not compile-
-/// time constants.
+/// This function returns std::nullopt if the addrec coefficients are not
+/// compile- time constants.
static std::optional<std::tuple<APInt, APInt, APInt, APInt, unsigned>>
GetQuadraticEquation(const SCEVAddRecExpr *AddRec) {
assert(AddRec->getNumOperands() == 3 && "This is not a quadratic chrec!");
@@ -10059,7 +10059,7 @@ GetQuadraticEquation(const SCEVAddRecExpr *AddRec) {
/// Helper function to compare optional APInts:
/// (a) if X and Y both exist, return min(X, Y),
-/// (b) if neither X nor Y exist, return None,
+/// (b) if neither X nor Y exist, return std::nullopt,
/// (c) if exactly one of X and Y exists, return that value.
static Optional<APInt> MinOptional(Optional<APInt> X, Optional<APInt> Y) {
if (X && Y) {
@@ -10102,7 +10102,7 @@ static Optional<APInt> TruncIfPossible(Optional<APInt> X, unsigned BitWidth) {
/// returned as such, otherwise the bit width of the returned value may
/// be greater than BW.
///
-/// This function returns None if
+/// This function returns std::nullopt if
/// (a) the addrec coefficients are not constant, or
/// (b) SolveQuadraticEquationWrap was unable to find a solution. For cases
/// like x^2 = 5, no integer solutions exist, in other cases an integer
@@ -10135,7 +10135,7 @@ SolveQuadraticAddRecExact(const SCEVAddRecExpr *AddRec, ScalarEvolution &SE) {
/// Find the least n such that c(n) does not belong to the given range,
/// while c(n-1) does.
///
-/// This function returns None if
+/// This function returns std::nullopt if
/// (a) the addrec coefficients are not constant, or
/// (b) SolveQuadraticEquationWrap was unable to find a solution for the
/// bounds of the range.
@@ -10196,8 +10196,8 @@ SolveQuadraticAddRecRange(const SCEVAddRecExpr *AddRec,
return false;
};
- // If SolveQuadraticEquationWrap returns None, it means that there can
- // be a solution, but the function failed to find it. We cannot treat it
+ // If SolveQuadraticEquationWrap returns std::nullopt, it means that there
+ // can be a solution, but the function failed to find it. We cannot treat it
// as "no solution".
if (!SO || !UO)
return {std::nullopt, false};
@@ -10249,7 +10249,7 @@ SolveQuadraticAddRecRange(const SCEVAddRecExpr *AddRec,
// the range before or that we started outside of it. Both of these cases
// are contradictions.
//
- // Claim: In the case where SolveForBoundary returns None, the correct
+ // Claim: In the case where SolveForBoundary returns std::nullopt, the correct
// solution is not some value between the Max for this boundary and the
// Min of the other boundary.
//
diff --git a/llvm/lib/Analysis/VFABIDemangling.cpp b/llvm/lib/Analysis/VFABIDemangling.cpp
index c32ca6aaa858a..a0761716f1ab9 100644
--- a/llvm/lib/Analysis/VFABIDemangling.cpp
+++ b/llvm/lib/Analysis/VFABIDemangling.cpp
@@ -95,7 +95,7 @@ ParseRet tryParseVLEN(StringRef &ParseString, unsigned &VF, bool &IsScalable) {
/// On success, it removes the parsed parameter from `ParseString`,
/// sets `PKind` to the correspondent enum value, sets `Pos` to
/// <number>, and return success. On a syntax error, it return a
-/// parsing error. If nothing is parsed, it returns None.
+/// parsing error. If nothing is parsed, it returns std::nullopt.
///
/// The function expects <token> to be one of "ls", "Rs", "Us" or
/// "Ls".
@@ -122,7 +122,7 @@ ParseRet tryParseLinearTokenWithRuntimeStep(StringRef &ParseString,
/// On success, it removes the parsed parameter from `ParseString`,
/// sets `PKind` to the correspondent enum value, sets `StepOrPos` to
/// <number>, and return success. On a syntax error, it return a
-/// parsing error. If nothing is parsed, it returns None.
+/// parsing error. If nothing is parsed, it returns std::nullopt.
ParseRet tryParseLinearWithRuntimeStep(StringRef &ParseString,
VFParamKind &PKind, int &StepOrPos) {
ParseRet Ret;
@@ -158,7 +158,7 @@ ParseRet tryParseLinearWithRuntimeStep(StringRef &ParseString,
/// On success, it removes the parsed parameter from `ParseString`,
/// sets `PKind` to the correspondent enum value, sets `LinearStep` to
/// <number>, and return success. On a syntax error, it return a
-/// parsing error. If nothing is parsed, it returns None.
+/// parsing error. If nothing is parsed, it returns std::nullopt.
///
/// The function expects <token> to be one of "l", "R", "U" or
/// "L".
@@ -186,7 +186,7 @@ ParseRet tryParseCompileTimeLinearToken(StringRef &ParseString,
/// On success, it removes the parsed parameter from `ParseString`,
/// sets `PKind` to the correspondent enum value, sets `LinearStep` to
/// <number>, and return success. On a syntax error, it return a
-/// parsing error. If nothing is parsed, it returns None.
+/// parsing error. If nothing is parsed, it returns std::nullopt.
ParseRet tryParseLinearWithCompileTimeStep(StringRef &ParseString,
VFParamKind &PKind, int &StepOrPos) {
// "l" {"n"} <CompileTimeStep>
@@ -219,7 +219,7 @@ ParseRet tryParseLinearWithCompileTimeStep(StringRef &ParseString,
/// On success, it removes the parsed parameter from `ParseString`,
/// sets `PKind` to the correspondent enum value, sets `StepOrPos`
/// accordingly, and return success. On a syntax error, it return a
-/// parsing error. If nothing is parsed, it returns None.
+/// parsing error. If nothing is parsed, it returns std::nullopt.
ParseRet tryParseParameter(StringRef &ParseString, VFParamKind &PKind,
int &StepOrPos) {
if (ParseString.consume_front("v")) {
@@ -254,7 +254,7 @@ ParseRet tryParseParameter(StringRef &ParseString, VFParamKind &PKind,
/// On success, it removes the parsed parameter from `ParseString`,
/// sets `PKind` to the correspondent enum value, sets `StepOrPos`
/// accordingly, and return success. On a syntax error, it return a
-/// parsing error. If nothing is parsed, it returns None.
+/// parsing error. If nothing is parsed, it returns std::nullopt.
ParseRet tryParseAlign(StringRef &ParseString, Align &Alignment) {
uint64_t Val;
// "a" <number>
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 878177e08eabc..245942974a0f1 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -2742,7 +2742,7 @@ bool isKnownNonZero(const Value* V, unsigned Depth, const Query& Q) {
/// If the pair of operators are the same invertible function, return the
/// the operands of the function corresponding to each input. Otherwise,
-/// return None. An invertible function is one that is 1-to-1 and maps
+/// return std::nullopt. An invertible function is one that is 1-to-1 and maps
/// every input value to exactly one output value. This is equivalent to
/// saying that Op1 and Op2 are equal exactly when the specified pair of
/// operands are equal, (except that Op1 and Op2 may be poison more often.)
@@ -6657,7 +6657,7 @@ static bool isTruePredicate(CmpInst::Predicate Pred, const Value *LHS,
}
/// Return true if "icmp Pred BLHS BRHS" is true whenever "icmp Pred
-/// ALHS ARHS" is true. Otherwise, return None.
+/// ALHS ARHS" is true. Otherwise, return std::nullopt.
static Optional<bool>
isImpliedCondOperands(CmpInst::Predicate Pred, const Value *ALHS,
const Value *ARHS, const Value *BLHS, const Value *BRHS,
@@ -6694,7 +6694,7 @@ static bool areMatchingOperands(const Value *L0, const Value *L1, const Value *R
/// Return true if "icmp1 LPred X, Y" implies "icmp2 RPred X, Y" is true.
/// Return false if "icmp1 LPred X, Y" implies "icmp2 RPred X, Y" is false.
-/// Otherwise, return None if we can't infer anything.
+/// Otherwise, return std::nullopt if we can't infer anything.
static Optional<bool> isImpliedCondMatchingOperands(CmpInst::Predicate LPred,
CmpInst::Predicate RPred,
bool AreSwappedOps) {
@@ -6712,7 +6712,7 @@ static Optional<bool> isImpliedCondMatchingOperands(CmpInst::Predicate LPred,
/// Return true if "icmp LPred X, LC" implies "icmp RPred X, RC" is true.
/// Return false if "icmp LPred X, LC" implies "icmp RPred X, RC" is false.
-/// Otherwise, return None if we can't infer anything.
+/// Otherwise, return std::nullopt if we can't infer anything.
static Optional<bool> isImpliedCondCommonOperandWithConstants(
CmpInst::Predicate LPred, const APInt &LC, CmpInst::Predicate RPred,
const APInt &RC) {
@@ -6728,8 +6728,8 @@ static Optional<bool> isImpliedCondCommonOperandWithConstants(
}
/// Return true if LHS implies RHS (expanded to its components as "R0 RPred R1")
-/// is true. Return false if LHS implies RHS is false. Otherwise, return None
-/// if we can't infer anything.
+/// is true. Return false if LHS implies RHS is false. Otherwise, return
+/// std::nullopt if we can't infer anything.
static Optional<bool> isImpliedCondICmps(const ICmpInst *LHS,
CmpInst::Predicate RPred,
const Value *R0, const Value *R1,
@@ -6761,8 +6761,9 @@ static Optional<bool> isImpliedCondICmps(const ICmpInst *LHS,
}
/// Return true if LHS implies RHS is true. Return false if LHS implies RHS is
-/// false. Otherwise, return None if we can't infer anything. We expect the
-/// RHS to be an icmp and the LHS to be an 'and', 'or', or a 'select' instruction.
+/// false. Otherwise, return std::nullopt if we can't infer anything. We
+/// expect the RHS to be an icmp and the LHS to be an 'and', 'or', or a 'select'
+/// instruction.
static Optional<bool>
isImpliedCondAndOr(const Instruction *LHS, CmpInst::Predicate RHSPred,
const Value *RHSOp0, const Value *RHSOp1,
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 3062c638b9efb..e6fea6f81c2ab 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -1433,7 +1433,7 @@ bool matchIncrement(const Instruction *IVInc, Instruction *&LHS,
/// If given \p PN is an inductive variable with value IVInc coming from the
/// backedge, and on each iteration it gets increased by Step, return pair
-/// <IVInc, Step>. Otherwise, return None.
+/// <IVInc, Step>. Otherwise, return std::nullopt.
static std::optional<std::pair<Instruction *, Constant *>>
getIVIncrement(const PHINode *PN, const LoopInfo *LI) {
const Loop *L = LI->getLoopFor(PN->getParent());
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 3db4dc4949b18..fcaf97d0c15a1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -7892,8 +7892,8 @@ struct ByteProvider {
/// byte of the given value. Returns None if the provider can't be calculated.
///
/// For all the values except the root of the expression, we verify that the
-/// value has exactly one use and if not then return None. This way if the
-/// origin of the byte is returned it's guaranteed that the values which
+/// value has exactly one use and if not then return std::nullopt. This way if
+/// the origin of the byte is returned it's guaranteed that the values which
/// contribute to the byte are not used outside of this expression.
/// However, there is a special case when dealing with vector loads -- we allow
diff --git a/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp b/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
index 86fa52654a027..a899bba244045 100644
--- a/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
@@ -492,7 +492,8 @@ void MarkupFilter::printValue(Twine Value) {
}
// This macro helps reduce the amount of indirection done through Optional
-// below, since the usual case upon returning a None Optional is to return None.
+// below, since the usual case upon returning a std::nullopt Optional is to
+// return None.
#define ASSIGN_OR_RETURN_NONE(TYPE, NAME, EXPR) \
auto NAME##Opt = (EXPR); \
if (!NAME##Opt) \
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 92491a0c7a1e8..39e84fffcc4c6 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -4970,7 +4970,7 @@ MachOObjectFile::getChainedFixupsLoadCommand() const {
*DyldChainedFixupsOrErr;
// If the load command is present but the data offset has been zeroed out,
- // as is the case for dylib stubs, return None (no error).
+ // as is the case for dylib stubs, return std::nullopt (no error).
if (!DyldChainedFixups.dataoff)
return std::nullopt;
return DyldChainedFixups;
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
index 353692c5d003a..6b8bc31992736 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -1643,7 +1643,7 @@ static UsedNZCV getUsedNZCV(AArch64CC::CondCode CC) {
/// \returns Conditions flags used after \p CmpInstr in its MachineBB if NZCV
/// flags are not alive in successors of the same \p CmpInstr and \p MI parent.
-/// \returns None otherwise.
+/// \returns std::nullopt otherwise.
///
/// Collect instructions using that flags in \p CCUseInstrs if provided.
std::optional<UsedNZCV>
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.h b/llvm/lib/Target/AArch64/AArch64InstrInfo.h
index 65792f3244492..a7402cae216f4 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.h
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.h
@@ -389,7 +389,7 @@ struct UsedNZCV {
/// \returns Conditions flags used after \p CmpInstr in its MachineBB if NZCV
/// flags are not alive in successors of the same \p CmpInstr and \p MI parent.
-/// \returns None otherwise.
+/// \returns std::nullopt otherwise.
///
/// Collect instructions using that flags in \p CCUseInstrs if provided.
std::optional<UsedNZCV>
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
index 89cb642bdd091..a859112103a17 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
@@ -5992,7 +5992,7 @@ AArch64InstructionSelector::selectShiftB_64(const MachineOperand &Root) const {
/// Helper to select an immediate value that can be represented as a 12-bit
/// value shifted left by either 0 or 12. If it is possible to do so, return
-/// the immediate and shift value. If not, return None.
+/// the immediate and shift value. If not, return std::nullopt.
///
/// Used by selectArithImmed and selectNegArithImmed.
InstructionSelector::ComplexRendererFns
@@ -6251,8 +6251,8 @@ AArch64InstructionSelector::selectAddrModeShiftedExtendXReg(
///
/// Where x2 is the base register, and x3 is an offset register.
///
-/// When possible (or profitable) to fold a G_PTR_ADD into the address calculation,
-/// this will do so. Otherwise, it will return None.
+/// When possible (or profitable) to fold a G_PTR_ADD into the address
+/// calculation, this will do so. Otherwise, it will return std::nullopt.
InstructionSelector::ComplexRendererFns
AArch64InstructionSelector::selectAddrModeRegisterOffset(
MachineOperand &Root) const {
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
index 741ec22d29cc1..4428c4f50fee1 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
@@ -89,9 +89,9 @@ void PPCELFStreamer::emitInstruction(const MCInst &Inst,
static_cast<PPCMCCodeEmitter*>(getAssembler().getEmitterPtr());
// If the instruction is a part of the GOT to PC-Rel link time optimization
- // instruction pair, return a value, otherwise return None. A true returned
- // value means the instruction is the PLDpc and a false value means it is
- // the user instruction.
+ // instruction pair, return a value, otherwise return std::nullopt. A true
+ // returned value means the instruction is the PLDpc and a false value means
+ // it is the user instruction.
std::optional<bool> IsPartOfGOTToPCRelPair =
isPartOfGOTToPCRelPair(Inst, STI);
@@ -206,7 +206,8 @@ std::optional<bool> llvm::isPartOfGOTToPCRelPair(const MCInst &Inst,
unsigned LastOp = Inst.getNumOperands() - 1;
// The last operand needs to be an MCExpr and it needs to have a variant kind
// of VK_PPC_PCREL_OPT. If it does not satisfy these conditions it is not a
- // link time GOT PC Rel opt instruction and we can ignore it and return None.
+ // link time GOT PC Rel opt instruction and we can ignore it and return
+ // std::nullopt.
const MCOperand &Operand = Inst.getOperand(LastOp);
if (!Operand.isExpr())
return std::nullopt;
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 7bf4d4ab9d6b4..03f4a564035dc 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -8786,8 +8786,8 @@ struct NodeExtensionHelper {
/// anything. Instead they produce an optional CombineResult that if not None,
/// need to be materialized for the combine to be applied.
/// \see CombineResult::materialize.
- /// If the related CombineToTry function returns None, that means the combine
- /// didn't match.
+ /// If the related CombineToTry function returns std::nullopt, that means the
+ /// combine didn't match.
static SmallVector<CombineToTry> getSupportedFoldings(const SDNode *Root);
};
@@ -8835,8 +8835,8 @@ struct CombineResult {
/// \note If the pattern can match with both zext and sext, the returned
/// CombineResult will feature the zext result.
///
-/// \returns None if the pattern doesn't match or a CombineResult that can be
-/// used to apply the pattern.
+/// \returns std::nullopt if the pattern doesn't match or a CombineResult that
+/// can be used to apply the pattern.
static std::optional<CombineResult>
canFoldToVWWithSameExtensionImpl(SDNode *Root, const NodeExtensionHelper &LHS,
const NodeExtensionHelper &RHS, bool AllowSExt,
@@ -8861,8 +8861,8 @@ canFoldToVWWithSameExtensionImpl(SDNode *Root, const NodeExtensionHelper &LHS,
/// where `ext` is the same for both LHS and RHS (i.e., both are sext or both
/// are zext) and LHS and RHS can be folded into Root.
///
-/// \returns None if the pattern doesn't match or a CombineResult that can be
-/// used to apply the pattern.
+/// \returns std::nullopt if the pattern doesn't match or a CombineResult that
+/// can be used to apply the pattern.
static std::optional<CombineResult>
canFoldToVWWithSameExtension(SDNode *Root, const NodeExtensionHelper &LHS,
const NodeExtensionHelper &RHS) {
@@ -8872,8 +8872,8 @@ canFoldToVWWithSameExtension(SDNode *Root, const NodeExtensionHelper &LHS,
/// Check if \p Root follows a pattern Root(LHS, ext(RHS))
///
-/// \returns None if the pattern doesn't match or a CombineResult that can be
-/// used to apply the pattern.
+/// \returns std::nullopt if the pattern doesn't match or a CombineResult that
+/// can be used to apply the pattern.
static std::optional<CombineResult>
canFoldToVW_W(SDNode *Root, const NodeExtensionHelper &LHS,
const NodeExtensionHelper &RHS) {
@@ -8897,8 +8897,8 @@ canFoldToVW_W(SDNode *Root, const NodeExtensionHelper &LHS,
/// Check if \p Root follows a pattern Root(sext(LHS), sext(RHS))
///
-/// \returns None if the pattern doesn't match or a CombineResult that can be
-/// used to apply the pattern.
+/// \returns std::nullopt if the pattern doesn't match or a CombineResult that
+/// can be used to apply the pattern.
static std::optional<CombineResult>
canFoldToVWWithSEXT(SDNode *Root, const NodeExtensionHelper &LHS,
const NodeExtensionHelper &RHS) {
@@ -8908,8 +8908,8 @@ canFoldToVWWithSEXT(SDNode *Root, const NodeExtensionHelper &LHS,
/// Check if \p Root follows a pattern Root(zext(LHS), zext(RHS))
///
-/// \returns None if the pattern doesn't match or a CombineResult that can be
-/// used to apply the pattern.
+/// \returns std::nullopt if the pattern doesn't match or a CombineResult that
+/// can be used to apply the pattern.
static std::optional<CombineResult>
canFoldToVWWithZEXT(SDNode *Root, const NodeExtensionHelper &LHS,
const NodeExtensionHelper &RHS) {
@@ -8919,8 +8919,8 @@ canFoldToVWWithZEXT(SDNode *Root, const NodeExtensionHelper &LHS,
/// Check if \p Root follows a pattern Root(sext(LHS), zext(RHS))
///
-/// \returns None if the pattern doesn't match or a CombineResult that can be
-/// used to apply the pattern.
+/// \returns std::nullopt if the pattern doesn't match or a CombineResult that
+/// can be used to apply the pattern.
static std::optional<CombineResult>
canFoldToVW_SU(SDNode *Root, const NodeExtensionHelper &LHS,
const NodeExtensionHelper &RHS) {
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 171546094451a..4ce9611f1bf4b 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -2845,7 +2845,7 @@ struct AAUndefinedBehaviorImpl : public AAUndefinedBehavior {
// - If the value is assumed, then stop.
// - If the value is known but undef, then consider it UB.
// - Otherwise, do specific processing with the simplified value.
- // We return None in the first 2 cases to signify that an appropriate
+ // We return std::nullopt in the first 2 cases to signify that an appropriate
// action was taken and the caller should stop.
// Otherwise, we return the simplified value that the caller should
// use for specific processing.
diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index 1b1d8647c54b9..d4ff9f68852de 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -462,7 +462,7 @@ void OutlinableRegion::reattachCandidate() {
/// \param GVNToConstant - The mapping of global value number to Constants.
/// \returns true if the Value matches the Constant mapped to by V and false if
/// it \p V is a Constant but does not match.
-/// \returns None if \p V is not a Constant.
+/// \returns std::nullopt if \p V is not a Constant.
static Optional<bool>
constantMatches(Value *V, unsigned GVN,
DenseMap<unsigned, Constant *> &GVNToConstant) {
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index a3af1fa0663dc..9a7738f99e549 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -2484,7 +2484,7 @@ struct AAICVTrackerFunction : public AAICVTracker {
return nullptr;
}
- // We don't check unique value for a function, so return None.
+ // We don't check unique value for a function, so return std::nullopt.
Optional<Value *>
getUniqueReplacementValue(InternalControlVar ICV) const override {
return std::nullopt;
diff --git a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
index e9cf000eee14c..6d39c6d043e4b 100644
--- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
@@ -171,7 +171,7 @@ class MemProfiler {
/// If it is an interesting memory access, populate information
/// about the access and return a InterestingMemoryAccess struct.
- /// Otherwise return None.
+ /// Otherwise return std::nullopt.
Optional<InterestingMemoryAccess>
isInterestingMemoryAccess(Instruction *I) const;
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 44d23a176a03d..95a35e395bc32 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -1293,7 +1293,7 @@ struct DSEState {
// Find a MemoryDef writing to \p KillingLoc and dominating \p StartAccess,
// with no read access between them or on any other path to a function exit
// block if \p KillingLoc is not accessible after the function returns. If
- // there is no such MemoryDef, return None. The returned value may not
+ // there is no such MemoryDef, return std::nullopt. The returned value may not
// (completely) overwrite \p KillingLoc. Currently we bail out when we
// encounter an aliasing MemoryUse (read).
Optional<MemoryAccess *>
diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
index a89424c425855..6e5a4153e7883 100644
--- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
@@ -1581,7 +1581,7 @@ bool LoopConstrainer::run() {
/// Computes and returns a range of values for the induction variable (IndVar)
/// in which the range check can be safely elided. If it cannot compute such a
-/// range, returns None.
+/// range, returns std::nullopt.
Optional<InductiveRangeCheck::Range>
InductiveRangeCheck::computeSafeIterationSpace(
ScalarEvolution &SE, const SCEVAddRecExpr *IndVar,
@@ -1733,7 +1733,7 @@ IntersectSignedRange(ScalarEvolution &SE,
const SCEV *NewBegin = SE.getSMaxExpr(R1Value.getBegin(), R2.getBegin());
const SCEV *NewEnd = SE.getSMinExpr(R1Value.getEnd(), R2.getEnd());
- // If the resulting range is empty, just return None.
+ // If the resulting range is empty, just return std::nullopt.
auto Ret = InductiveRangeCheck::Range(NewBegin, NewEnd);
if (Ret.isEmpty(SE, /* IsSigned */ true))
return std::nullopt;
@@ -1762,7 +1762,7 @@ IntersectUnsignedRange(ScalarEvolution &SE,
const SCEV *NewBegin = SE.getUMaxExpr(R1Value.getBegin(), R2.getBegin());
const SCEV *NewEnd = SE.getUMinExpr(R1Value.getEnd(), R2.getEnd());
- // If the resulting range is empty, just return None.
+ // If the resulting range is empty, just return std::nullopt.
auto Ret = InductiveRangeCheck::Range(NewBegin, NewEnd);
if (Ret.isEmpty(SE, /* IsSigned */ false))
return std::nullopt;
diff --git a/llvm/lib/Transforms/Scalar/LoopPredication.cpp b/llvm/lib/Transforms/Scalar/LoopPredication.cpp
index a5dddbeb3357f..054674d0ba0b0 100644
--- a/llvm/lib/Transforms/Scalar/LoopPredication.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopPredication.cpp
@@ -684,10 +684,9 @@ static void normalizePredicate(ScalarEvolution *SE, Loop *L,
ICmpInst::ICMP_ULT : ICmpInst::ICMP_UGE;
}
-
/// If ICI can be widened to a loop invariant condition emits the loop
/// invariant condition in the loop preheader and return it, otherwise
-/// returns None.
+/// returns std::nullopt.
Optional<Value *> LoopPredication::widenICmpRangeCheck(ICmpInst *ICI,
SCEVExpander &Expander,
Instruction *Guard) {
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp
index 3d9fd56962dd9..074af66282d41 100644
--- a/llvm/lib/Transforms/Utils/ValueMapper.cpp
+++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp
@@ -270,8 +270,8 @@ class MDNodeMapper {
/// MDNode, compute and return the mapping. If it's a distinct \a MDNode,
/// return the result of \a mapDistinctNode().
///
- /// \return None if \c Op is an unmapped uniqued \a MDNode.
- /// \post getMappedOp(Op) only returns None if this returns None.
+ /// \return std::nullopt if \c Op is an unmapped uniqued \a MDNode.
+ /// \post getMappedOp(Op) only returns std::nullopt if this returns None.
Optional<Metadata *> tryToMapOperand(const Metadata *Op);
/// Map a distinct node.
@@ -317,11 +317,10 @@ class MDNodeMapper {
/// This visits all the nodes in \c G in post-order, using the identity
/// mapping or creating a new node depending on \a Data::HasChanged.
///
- /// \pre \a getMappedOp() returns None for nodes in \c G, but not for any of
- /// their operands outside of \c G.
- /// \pre \a Data::HasChanged is true for a node in \c G iff any of its
- /// operands have changed.
- /// \post \a getMappedOp() returns the mapped node for every node in \c G.
+ /// \pre \a getMappedOp() returns std::nullopt for nodes in \c G, but not for
+ /// any of their operands outside of \c G. \pre \a Data::HasChanged is true
+ /// for a node in \c G iff any of its operands have changed. \post \a
+ /// getMappedOp() returns the mapped node for every node in \c G.
void mapNodesInPOT(UniquedGraph &G);
/// Remap a node's operands using the given functor.
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index ea3fac81064ab..27d0b18638a1c 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -1641,7 +1641,7 @@ class BoUpSLP {
// Search all operands in Ops[*][Lane] for the one that matches best
// Ops[OpIdx][LastLane] and return its opreand index.
- // If no good match can be found, return None.
+ // If no good match can be found, return std::nullopt.
Optional<unsigned> getBestOperand(unsigned OpIdx, int Lane, int LastLane,
ArrayRef<ReorderingMode> ReorderingModes,
ArrayRef<Value *> MainAltOps) {
@@ -1721,7 +1721,7 @@ class BoUpSLP {
getData(*BestOp.Idx, Lane).IsUsed = IsUsed;
return BestOp.Idx;
}
- // If we could not find a good match return None.
+ // If we could not find a good match return std::nullopt.
return std::nullopt;
}
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 565e2325a8786..228e094f53550 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -1681,8 +1681,8 @@ static void disassembleObject(const Target *TheTarget, ObjectFile &Obj,
SectionAddr + Start, CommentStream);
if (!Status) {
- // If onSymbolStart returns None, that means it didn't trigger any
- // interesting handling for this symbol. Try the other symbols
+ // If onSymbolStart returns std::nullopt, that means it didn't trigger
+ // any interesting handling for this symbol. Try the other symbols
// defined at this address.
continue;
}
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index bdab1f60d0933..3ffa45663d63b 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -1214,7 +1214,7 @@ TEST_F(DILocationTest, discriminatorSpecialCases) {
.value()
->getDuplicationFactor());
- // Check we return None for unencodable cases.
+ // Check we return std::nullopt for unencodable cases.
EXPECT_EQ(std::nullopt, L4->cloneWithBaseDiscriminator(0x1000));
EXPECT_EQ(std::nullopt, L4->cloneByMultiplyingDuplicationFactor(0x1000));
}
diff --git a/llvm/unittests/Support/DataExtractorTest.cpp b/llvm/unittests/Support/DataExtractorTest.cpp
index 358751cbb1292..4b240d1e26640 100644
--- a/llvm/unittests/Support/DataExtractorTest.cpp
+++ b/llvm/unittests/Support/DataExtractorTest.cpp
@@ -344,7 +344,8 @@ TEST(DataExtractorTest, FixedLengthString) {
DataExtractor DE(StringRef(Data, sizeof(Data)-1), false, 8);
uint64_t Offset = 0;
StringRef Str;
- // Test extracting too many bytes doesn't modify Offset and returns None.
+ // Test extracting too many bytes doesn't modify Offset and returns
+ // std::nullopt.
Str = DE.getFixedLengthString(&Offset, sizeof(Data));
EXPECT_TRUE(Str.empty());
EXPECT_EQ(Offset, 0u);
@@ -374,7 +375,8 @@ TEST(DataExtractorTest, GetBytes) {
DataExtractor DE(Bytes, false, 8);
uint64_t Offset = 0;
StringRef Str;
- // Test extracting too many bytes doesn't modify Offset and returns None.
+ // Test extracting too many bytes doesn't modify Offset and returns
+ // std::nullopt.
Str = DE.getBytes(&Offset, sizeof(Data));
EXPECT_TRUE(Str.empty());
EXPECT_EQ(Offset, 0u);
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index ecc3e79a2772d..d253417e7c25b 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -3682,7 +3682,7 @@ class GlobalISelEmitter {
/// Infer a CodeGenRegisterClass for the type of \p SuperRegNode. The returned
/// CodeGenRegisterClass will support the CodeGenRegisterClass of
/// \p SubRegNode, and the subregister index defined by \p SubRegIdxNode.
- /// If no register class is found, return None.
+ /// If no register class is found, return std::nullopt.
Optional<const CodeGenRegisterClass *>
inferSuperRegisterClassForNode(const TypeSetByHwMode &Ty,
TreePatternNode *SuperRegNode,
More information about the llvm-commits
mailing list