[llvm] 9f252e5 - [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:31:23 PST 2022
Author: Kazu Hirata
Date: 2022-12-04T17:31:17-08:00
New Revision: 9f252e5567041bcafe20980263381e4ad3c8986e
URL: https://github.com/llvm/llvm-project/commit/9f252e5567041bcafe20980263381e4ad3c8986e
DIFF: https://github.com/llvm/llvm-project/commit/9f252e5567041bcafe20980263381e4ad3c8986e.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/Analysis/BranchProbabilityInfo.h
llvm/include/llvm/Analysis/InlineAdvisor.h
llvm/include/llvm/Analysis/LoopCacheAnalysis.h
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/include/llvm/Analysis/Utils/TFUtils.h
llvm/include/llvm/CodeGen/SelectionDAG.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
llvm/include/llvm/IR/DataLayout.h
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/include/llvm/IR/Instructions.h
llvm/include/llvm/MC/MCRegisterInfo.h
llvm/include/llvm/MC/MCStreamer.h
llvm/include/llvm/Remarks/HotnessThresholdParser.h
llvm/lib/Analysis/InlineAdvisor.cpp
llvm/lib/Analysis/InlineCost.cpp
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
llvm/lib/IR/DebugInfo.cpp
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/lib/Transforms/Scalar/Float2Int.cpp
llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
llvm/lib/Transforms/Utils/ValueMapper.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
llvm/tools/llvm-readobj/ELFDumper.cpp
llvm/utils/TableGen/GlobalISelEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/BranchProbabilityInfo.h b/llvm/include/llvm/Analysis/BranchProbabilityInfo.h
index 28418198aceaa..51c6ef3fccd9e 100644
--- a/llvm/include/llvm/Analysis/BranchProbabilityInfo.h
+++ b/llvm/include/llvm/Analysis/BranchProbabilityInfo.h
@@ -361,12 +361,12 @@ class BranchProbabilityInfo {
Optional<uint32_t> getEstimatedBlockWeight(const BasicBlock *BB) const;
/// Returns estimated weight to enter \p L. In other words it is weight of
- /// loop's header block not scaled by trip count. Returns None if \p L has no
- /// no estimated weight.
+ /// loop's header block not scaled by trip count. Returns std::nullopt if \p L
+ /// has no no estimated weight.
Optional<uint32_t> getEstimatedLoopWeight(const LoopData &L) const;
- /// Return estimated weight for \p Edge. Returns None if estimated weight is
- /// unknown.
+ /// Return estimated weight for \p Edge. Returns std::nullopt if estimated
+ /// weight is unknown.
Optional<uint32_t> getEstimatedEdgeWeight(const LoopEdge &Edge) const;
/// Iterates over all edges leading from \p SrcBB to \p Successors and
diff --git a/llvm/include/llvm/Analysis/InlineAdvisor.h b/llvm/include/llvm/Analysis/InlineAdvisor.h
index 42063ea3887c4..150ae978b2f25 100644
--- a/llvm/include/llvm/Analysis/InlineAdvisor.h
+++ b/llvm/include/llvm/Analysis/InlineAdvisor.h
@@ -293,8 +293,8 @@ getDevelopmentModeAdvisor(Module &M, ModuleAnalysisManager &MAM,
/// Return the cost only if the inliner should attempt to inline at the given
/// CallSite. If we return the cost, we will emit an optimisation remark later
-/// using that cost, so we won't do so from this function. Return None if
-/// inlining should not be attempted.
+/// using that cost, so we won't do so from this function. Return std::nullopt
+/// if inlining should not be attempted.
Optional<InlineCost>
shouldInline(CallBase &CB, function_ref<InlineCost(CallBase &CB)> GetInlineCost,
OptimizationRemarkEmitter &ORE, bool EnableDeferral = true);
diff --git a/llvm/include/llvm/Analysis/LoopCacheAnalysis.h b/llvm/include/llvm/Analysis/LoopCacheAnalysis.h
index c6d4382533f48..6c5a3ad8cbc9d 100644
--- a/llvm/include/llvm/Analysis/LoopCacheAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopCacheAnalysis.h
@@ -72,7 +72,7 @@ class IndexedReference {
/// Return true/false if the current object and the indexed reference \p Other
/// are/aren't in the same cache line of size \p CLS. Two references are in
/// the same chace line iff the distance between them in the innermost
- /// dimension is less than the cache line size. Return None if unsure.
+ /// dimension is less than the cache line size. Return std::nullopt if unsure.
Optional<bool> hasSpacialReuse(const IndexedReference &Other, unsigned CLS,
AAResults &AA) const;
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index 6a2dbf79de7ac..e57a01f5d408d 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -537,8 +537,8 @@ class ScalarEvolution {
/// Parse NSW/NUW flags from add/sub/mul IR binary operation \p Op into
/// SCEV no-wrap flags, and deduce flag[s] that aren't known yet.
- /// Does not mutate the original instruction. Returns None if it could not
- /// deduce more precise flags than the instruction already has, otherwise
+ /// Does not mutate the original instruction. Returns std::nullopt if it could
+ /// not deduce more precise flags than the instruction already has, otherwise
/// returns proven flags.
Optional<SCEV::NoWrapFlags>
getStrengthenedNoWrapFlagsFromBinOp(const OverflowingBinaryOperator *OBO);
diff --git a/llvm/include/llvm/Analysis/Utils/TFUtils.h b/llvm/include/llvm/Analysis/Utils/TFUtils.h
index 637641a779872..7cb72acb80d19 100644
--- a/llvm/include/llvm/Analysis/Utils/TFUtils.h
+++ b/llvm/include/llvm/Analysis/Utils/TFUtils.h
@@ -82,10 +82,10 @@ class TFModelEvaluator final {
TFModelEvaluator(const TFModelEvaluator &) = delete;
TFModelEvaluator(TFModelEvaluator &&) = delete;
- /// Evaluate the model, assuming it is valid. Returns None if the evaluation
- /// fails or the model is invalid, or an EvaluationResult otherwise. The
- /// inputs are assumed to have been already provided via getInput(). When
- /// returning None, it also invalidates this object.
+ /// Evaluate the model, assuming it is valid. Returns std::nullopt if the
+ /// evaluation fails or the model is invalid, or an EvaluationResult
+ /// otherwise. The inputs are assumed to have been already provided via
+ /// getInput(). When returning None, it also invalidates this object.
Optional<EvaluationResult> evaluate();
/// Provides access to the input vector.
diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h
index 40f9a97fa3816..2af9fe4a970a0 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAG.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAG.h
@@ -2156,8 +2156,8 @@ class SelectionDAG {
bool areNonVolatileConsecutiveLoads(LoadSDNode *LD, LoadSDNode *Base,
unsigned Bytes, int Dist) const;
- /// Infer alignment of a load / store address. Return None if it cannot be
- /// inferred.
+ /// Infer alignment of a load / store address. Return std::nullopt if it
+ /// cannot be inferred.
MaybeAlign InferPtrAlign(SDValue Ptr) const;
/// Compute the VTs needed for the low/hi parts of a type
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
index 9549a57894885..ae2a4e2276da0 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
@@ -69,7 +69,7 @@ class DWARFDebugAddrTable {
Expected<uint64_t> getAddrEntry(uint32_t Index) const;
/// Return the full length of this table, including the length field.
- /// Return None if the length cannot be identified reliably.
+ /// Return std::nullopt if the length cannot be identified reliably.
std::optional<uint64_t> getFullLength() const;
/// Return the DWARF format of this table.
diff --git a/llvm/include/llvm/IR/DataLayout.h b/llvm/include/llvm/IR/DataLayout.h
index a6621c963d851..d607c2a766793 100644
--- a/llvm/include/llvm/IR/DataLayout.h
+++ b/llvm/include/llvm/IR/DataLayout.h
@@ -591,8 +591,8 @@ class DataLayout {
/// the result element type and Offset to be the residual offset.
SmallVector<APInt> getGEPIndicesForOffset(Type *&ElemTy, APInt &Offset) const;
- /// Get single GEP index to access Offset inside ElemTy. Returns None if
- /// index cannot be computed, e.g. because the type is not an aggregate.
+ /// Get single GEP index to access Offset inside ElemTy. Returns std::nullopt
+ /// if index cannot be computed, e.g. because the type is not an aggregate.
/// ElemTy is updated to be the result element type and Offset to be the
/// residual offset.
Optional<APInt> getGEPIndexForOffset(Type *&ElemTy, APInt &Offset) const;
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index e6bfea5f124b9..534de3d72b659 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -1745,7 +1745,7 @@ class DILocation : public MDNode {
/// Returns a new DILocation with duplication factor \p DF * current
/// duplication factor encoded in the discriminator. The current duplication
/// factor is as defined by getDuplicationFactor().
- /// Returns None if encoding failed.
+ /// Returns std::nullopt if encoding failed.
inline std::optional<const DILocation *>
cloneByMultiplyingDuplicationFactor(unsigned DF) const;
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index 1afb9e50e6563..55486e5ef6477 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -107,8 +107,8 @@ class AllocaInst : public UnaryInstruction {
return getType()->getAddressSpace();
}
- /// Get allocation size in bits. Returns None if size can't be determined,
- /// e.g. in case of a VLA.
+ /// Get allocation size in bits. Returns std::nullopt if size can't be
+ /// determined, e.g. in case of a VLA.
std::optional<TypeSize> getAllocationSizeInBits(const DataLayout &DL) const;
/// Return the type that is being allocated by the instruction.
diff --git a/llvm/include/llvm/MC/MCRegisterInfo.h b/llvm/include/llvm/MC/MCRegisterInfo.h
index 40095c193fad6..520b6946db91d 100644
--- a/llvm/include/llvm/MC/MCRegisterInfo.h
+++ b/llvm/include/llvm/MC/MCRegisterInfo.h
@@ -512,8 +512,8 @@ class MCRegisterInfo {
/// debugging info.
int getDwarfRegNum(MCRegister RegNum, bool isEH) const;
- /// Map a dwarf register back to a target register. Returns None is there is
- /// no mapping.
+ /// Map a dwarf register back to a target register. Returns std::nullopt is
+ /// there is no mapping.
std::optional<unsigned> getLLVMRegNum(unsigned RegNum, bool isEH) const;
/// Map a target EH register number to an equivalent DWARF register
diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index bdab8e3a3f3ae..a53435e09b4ff 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -1084,8 +1084,8 @@ class MCStreamer {
virtual void emitSyntaxDirective();
- /// Record a relocation described by the .reloc directive. Return None if
- /// succeeded. Otherwise, return a pair (Name is invalid, error message).
+ /// Record a relocation described by the .reloc directive. Return std::nullopt
+ /// if succeeded. Otherwise, return a pair (Name is invalid, error message).
virtual std::optional<std::pair<bool, std::string>>
emitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr,
SMLoc Loc, const MCSubtargetInfo &STI) {
diff --git a/llvm/include/llvm/Remarks/HotnessThresholdParser.h b/llvm/include/llvm/Remarks/HotnessThresholdParser.h
index f78625c35e0d3..4cd0d2dff2fe6 100644
--- a/llvm/include/llvm/Remarks/HotnessThresholdParser.h
+++ b/llvm/include/llvm/Remarks/HotnessThresholdParser.h
@@ -26,8 +26,8 @@ namespace remarks {
// 1. integer: manually specified threshold; or
// 2. string 'auto': automatically get threshold from profile summary.
//
-// Return None Optional if 'auto' is specified, indicating the value will
-// be filled later during PSI.
+// Return std::nullopt Optional if 'auto' is specified, indicating the value
+// will be filled later during PSI.
inline Expected<std::optional<uint64_t>> parseHotnessThresholdOption(StringRef Arg) {
if (Arg == "auto")
return std::nullopt;
diff --git a/llvm/lib/Analysis/InlineAdvisor.cpp b/llvm/lib/Analysis/InlineAdvisor.cpp
index ae57a9754c66b..97ce2d102d495 100644
--- a/llvm/lib/Analysis/InlineAdvisor.cpp
+++ b/llvm/lib/Analysis/InlineAdvisor.cpp
@@ -364,8 +364,8 @@ void llvm::setInlineRemark(CallBase &CB, StringRef Message) {
/// Return the cost only if the inliner should attempt to inline at the given
/// CallSite. If we return the cost, we will emit an optimisation remark later
-/// using that cost, so we won't do so from this function. Return None if
-/// inlining should not be attempted.
+/// using that cost, so we won't do so from this function. Return std::nullopt
+/// if inlining should not be attempted.
Optional<InlineCost>
llvm::shouldInline(CallBase &CB,
function_ref<InlineCost(CallBase &CB)> GetInlineCost,
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 9a5f985acf071..ab414f67a22b5 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -813,8 +813,8 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
}
// Determine whether we should inline the given call site, taking into account
- // both the size cost and the cycle savings. Return None if we don't have
- // suficient profiling information to determine.
+ // both the size cost and the cycle savings. Return std::nullopt if we don't
+ // have suficient profiling information to determine.
std::optional<bool> costBenefitAnalysis() {
if (!CostBenefitAnalysisEnabled)
return std::nullopt;
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
index c12608515e64f..27438da368ffa 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
@@ -890,8 +890,8 @@ class MLocTracker {
void writeRegMask(const MachineOperand *MO, unsigned CurBB, unsigned InstID);
/// Find LocIdx for SpillLoc \p L, creating a new one if it's not tracked.
- /// Returns None when in scenarios where a spill slot could be tracked, but
- /// we would likely run into resource limitations.
+ /// Returns std::nullopt when in scenarios where a spill slot could be
+ /// tracked, but we would likely run into resource limitations.
Optional<SpillLocationNo> getOrTrackSpillLoc(SpillLoc L);
// Get LocIdx of a spill ID.
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index fcaf97d0c15a1..b63dc0594654c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -7889,7 +7889,8 @@ struct ByteProvider {
} // end anonymous namespace
/// Recursively traverses the expression calculating the origin of the requested
-/// byte of the given value. Returns None if the provider can't be calculated.
+/// byte of the given value. Returns std::nullopt 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 std::nullopt. This way if
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index c29261ea8bf90..76b09961b0534 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -11468,8 +11468,8 @@ bool SelectionDAG::areNonVolatileConsecutiveLoads(LoadSDNode *LD,
return false;
}
-/// InferPtrAlignment - Infer alignment of a load / store address. Return None
-/// if it cannot be inferred.
+/// InferPtrAlignment - Infer alignment of a load / store address. Return
+/// std::nullopt if it cannot be inferred.
MaybeAlign SelectionDAG::InferPtrAlign(SDValue Ptr) const {
// If this is a GlobalAddress + cst, return the alignment.
const GlobalValue *GV = nullptr;
diff --git a/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp b/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
index a899bba244045..f0681d9dd8566 100644
--- a/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
@@ -493,7 +493,7 @@ void MarkupFilter::printValue(Twine Value) {
// This macro helps reduce the amount of indirection done through Optional
// below, since the usual case upon returning a std::nullopt Optional is to
-// return None.
+// return std::nullopt.
#define ASSIGN_OR_RETURN_NONE(TYPE, NAME, EXPR) \
auto NAME##Opt = (EXPR); \
if (!NAME##Opt) \
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index dcdab1d39a093..5375edcf42f90 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -1746,7 +1746,7 @@ void at::deleteAll(Function *F) {
}
/// Collect constant properies (base, size, offset) of \p StoreDest.
-/// Return None if any properties are not constants.
+/// Return std::nullopt if any properties are not constants.
static std::optional<AssignmentInfo>
getAssignmentInfoImpl(const DataLayout &DL, const Value *StoreDest,
uint64_t SizeInBits) {
diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index 8d2a7f1e00ff1..ac26f1a43a70d 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -85,8 +85,8 @@ static bool isScalarMoveInstr(const MachineInstr &MI) {
}
}
-/// Get the EEW for a load or store instruction. Return None if MI is not
-/// a load or store which ignores SEW.
+/// Get the EEW for a load or store instruction. Return std::nullopt if MI is
+/// not a load or store which ignores SEW.
static std::optional<unsigned> getEEWForLoadStore(const MachineInstr &MI) {
switch (getRVVMCOpcode(MI.getOpcode())) {
default:
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index 467ab7fe2a556..2dbd64a16928d 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -476,8 +476,8 @@ static bool findArgParts(Argument *Arg, const DataLayout &DL, AAResults &AAR,
bool AreStoresAllowed = Arg->getParamByValType() && Arg->getParamAlign();
// An end user of a pointer argument is a load or store instruction.
- // Returns None if this load or store is not based on the argument. Return
- // true if we can promote the instruction, false otherwise.
+ // Returns std::nullopt if this load or store is not based on the argument.
+ // Return true if we can promote the instruction, false otherwise.
auto HandleEndUser = [&](auto *I, Type *Ty,
bool GuaranteedToExecute) -> Optional<bool> {
// Don't promote volatile or atomic instructions.
diff --git a/llvm/lib/Transforms/Scalar/Float2Int.cpp b/llvm/lib/Transforms/Scalar/Float2Int.cpp
index 432d53ec9759c..30967cc5efa9d 100644
--- a/llvm/lib/Transforms/Scalar/Float2Int.cpp
+++ b/llvm/lib/Transforms/Scalar/Float2Int.cpp
@@ -235,7 +235,7 @@ void Float2IntPass::walkBackwards() {
}
// Calculate result range from operand ranges.
-// Return None if the range cannot be calculated yet.
+// Return std::nullopt if the range cannot be calculated yet.
Optional<ConstantRange> Float2IntPass::calcRange(Instruction *I) {
SmallVector<ConstantRange, 4> OpRanges;
for (Value *O : I->operands()) {
diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
index 6e5a4153e7883..cf94818704bd6 100644
--- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
@@ -554,7 +554,7 @@ class LoopConstrainer {
// Compute a safe set of limits for the main loop to run in -- effectively the
// intersection of `Range' and the iteration space of the original loop.
- // Return None if unable to compute the set of subranges.
+ // Return std::nullopt if unable to compute the set of subranges.
Optional<SubRanges> calculateSubRanges(bool IsSignedPredicate) const;
// Clone `OriginalLoop' and return the result in CLResult. The IR after
diff --git a/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp b/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
index 53d09adcc251c..2ff5aec8f8496 100644
--- a/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
+++ b/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
@@ -58,8 +58,8 @@ class ControlConditions {
public:
/// Return a ControlConditions which stores all conditions required to execute
/// \p BB from \p Dominator. If \p MaxLookup is non-zero, it limits the
- /// number of conditions to collect. Return None if not all conditions are
- /// collected successfully, or we hit the limit.
+ /// number of conditions to collect. Return std::nullopt if not all conditions
+ /// are collected successfully, or we hit the limit.
static const Optional<ControlConditions>
collectControlConditions(const BasicBlock &BB, const BasicBlock &Dominator,
const DominatorTree &DT,
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp
index 074af66282d41..8b3ffb1d8cebb 100644
--- a/llvm/lib/Transforms/Utils/ValueMapper.cpp
+++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp
@@ -271,7 +271,8 @@ class MDNodeMapper {
/// return the result of \a mapDistinctNode().
///
/// \return std::nullopt if \c Op is an unmapped uniqued \a MDNode.
- /// \post getMappedOp(Op) only returns std::nullopt if this returns None.
+ /// \post getMappedOp(Op) only returns std::nullopt if this returns
+ /// std::nullopt.
Optional<Metadata *> tryToMapOperand(const Metadata *Op);
/// Map a distinct node.
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 9f6718b32f571..6ba0185f0ab01 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -402,7 +402,7 @@ static Constant *getSignedIntOrFpConstant(Type *Ty, int64_t C) {
/// 1) Returns exact trip count if it is known.
/// 2) Returns expected trip count according to profile data if any.
/// 3) Returns upper bound estimate if it is known.
-/// 4) Returns None if all of the above failed.
+/// 4) Returns std::nullopt if all of the above failed.
static Optional<unsigned> getSmallBestKnownTC(ScalarEvolution &SE, Loop *L) {
// Check if exact trip count is known.
if (unsigned ExpectedTC = SE.getSmallConstantTripCount(L))
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 27d0b18638a1c..8aa4f3de3976e 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -2139,9 +2139,9 @@ class BoUpSLP {
/// Evaluate each pair in \p Candidates and return index into \p Candidates
/// for a pair which have highest score deemed to have best chance to form
- /// root of profitable tree to vectorize. Return None if no candidate scored
- /// above the LookAheadHeuristics::ScoreFail.
- /// \param Limit Lower limit of the cost, considered to be good enough score.
+ /// root of profitable tree to vectorize. Return std::nullopt if no candidate
+ /// scored above the LookAheadHeuristics::ScoreFail. \param Limit Lower limit
+ /// of the cost, considered to be good enough score.
Optional<int>
findBestRootPair(ArrayRef<std::pair<Value *, Value *>> Candidates,
int Limit = LookAheadHeuristics::ScoreFail) {
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 228e094f53550..422e6e5ab9c45 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -1271,7 +1271,7 @@ static void createFakeELFSections(ObjectFile &Obj) {
}
// Tries to fetch a more complete version of the given object file using its
-// Build ID. Returns None if nothing was found.
+// Build ID. Returns std::nullopt if nothing was found.
static std::optional<OwningBinary<Binary>>
fetchBinaryByBuildID(const ObjectFile &Obj) {
std::optional<object::BuildIDRef> BuildID = getBuildID(&Obj);
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index d3357f5679edb..7d2b557efd9b3 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -306,8 +306,8 @@ template <typename ELFT> class ELFDumper : public ObjDumper {
// Returns the function symbol index for the given address. Matches the
// symbol's section with FunctionSec when specified.
- // Returns None if no function symbol can be found for the address or in case
- // it is not defined in the specified section.
+ // Returns std::nullopt if no function symbol can be found for the address or
+ // in case it is not defined in the specified section.
SmallVector<uint32_t>
getSymbolIndexesForFunctionAddress(uint64_t SymValue,
Optional<const Elf_Shdr *> FunctionSec);
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index d253417e7c25b..c908107f5bd56 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -3691,7 +3691,7 @@ class GlobalISelEmitter {
inferSubRegIndexForNode(TreePatternNode *SubRegIdxNode);
/// Infer a CodeGenRegisterClass which suppoorts \p Ty and \p SubRegIdxNode.
- /// Return None if no such class exists.
+ /// Return std::nullopt if no such class exists.
Optional<const CodeGenRegisterClass *>
inferSuperRegisterClass(const TypeSetByHwMode &Ty,
TreePatternNode *SubRegIdxNode);
@@ -3700,8 +3700,8 @@ class GlobalISelEmitter {
Optional<const CodeGenRegisterClass *>
getRegClassFromLeaf(TreePatternNode *Leaf);
- /// Return a CodeGenRegisterClass for \p N if one can be found. Return None
- /// otherwise.
+ /// Return a CodeGenRegisterClass for \p N if one can be found. Return
+ /// std::nullopt otherwise.
Optional<const CodeGenRegisterClass *>
inferRegClassFromPattern(TreePatternNode *N);
More information about the llvm-commits
mailing list