[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
This commit is contained in:
Kazu Hirata 2022-12-04 19:47:13 -08:00
parent 47edc70866
commit 595f1a6aaf
34 changed files with 100 additions and 97 deletions

View File

@ -371,7 +371,7 @@ private:
/// Iterates over all edges leading from \p SrcBB to \p Successors and
/// returns maximum of all estimated weights. If at least one edge has unknown
/// estimated weight None is returned.
/// estimated weight std::nullopt is returned.
template <class IterT>
Optional<uint32_t>
getMaxEstimatedEdgeWeight(const LoopBlock &SrcBB,

View File

@ -452,7 +452,7 @@ public:
// pairs that can be used to prove that there are no vectorization-preventing
// dependencies at runtime. There are is a vectorization-preventing dependency
// if any pointer-difference is <u VF * InterleaveCount * access size. Returns
// None if pointer-difference checks cannot be used.
// std::nullopt if pointer-difference checks cannot be used.
std::optional<ArrayRef<PointerDiffInfo>> getDiffChecks() const {
if (!CanUseDiffCheck)
return std::nullopt;

View File

@ -694,8 +694,8 @@ inline uint8_t getUnitLengthFieldByteSize(DwarfFormat Format) {
///
/// \param Form DWARF form to get the fixed byte size for.
/// \param Params DWARF parameters to help interpret forms.
/// \returns std::optional<uint8_t> value with the fixed byte size or None if
/// \p Form doesn't have a fixed byte size.
/// \returns std::optional<uint8_t> value with the fixed byte size or
/// std::nullopt if \p Form doesn't have a fixed byte size.
std::optional<uint8_t> getFixedFormByteSize(dwarf::Form Form,
FormParams Params);

View File

@ -473,7 +473,7 @@ bool isConstantOrConstantVector(MachineInstr &MI,
/// Determines if \p MI defines a constant integer or a splat vector of
/// constant integers.
/// \returns the scalar constant or None.
/// \returns the scalar constant or std::nullopt.
Optional<APInt> isConstantOrConstantSplatVector(MachineInstr &MI,
const MachineRegisterInfo &MRI);

View File

@ -51,12 +51,12 @@ public:
public:
/// Returns the Offset of the Compilation Unit associated with this
/// Accelerator Entry or None if the Compilation Unit offset is not recorded
/// in this Accelerator Entry.
/// Accelerator Entry or std::nullopt if the Compilation Unit offset is not
/// recorded in this Accelerator Entry.
virtual std::optional<uint64_t> getCUOffset() const = 0;
/// Returns the Tag of the Debug Info Entry associated with this
/// Accelerator Entry or None if the Tag is not recorded in this
/// Accelerator Entry or std::nullopt if the Tag is not recorded in this
/// Accelerator Entry.
virtual std::optional<dwarf::Tag> getTag() const = 0;
@ -126,9 +126,9 @@ public:
std::optional<uint64_t> getCUOffset() const override;
/// Returns the Section Offset of the Debug Info Entry associated with this
/// Accelerator Entry or None if the DIE offset is not recorded in this
/// Accelerator Entry. The returned offset is relative to the start of the
/// Section containing the DIE.
/// Accelerator Entry or std::nullopt if the DIE offset is not recorded in
/// this Accelerator Entry. The returned offset is relative to the start of
/// the Section containing the DIE.
std::optional<uint64_t> getDIESectionOffset() const;
std::optional<dwarf::Tag> getTag() const override;
@ -292,12 +292,12 @@ public:
std::optional<dwarf::Tag> getTag() const override { return tag(); }
/// Returns the Index into the Compilation Unit list of the owning Name
/// Index or None if this Accelerator Entry does not have an associated
/// Compilation Unit. It is up to the user to verify that the returned Index
/// is valid in the owning NameIndex (or use getCUOffset(), which will
/// handle that check itself). Note that entries in NameIndexes which index
/// just a single Compilation Unit are implicitly associated with that unit,
/// so this function will return 0 even without an explicit
/// Index or std::nullopt if this Accelerator Entry does not have an
/// associated Compilation Unit. It is up to the user to verify that the
/// returned Index is valid in the owning NameIndex (or use getCUOffset(),
/// which will handle that check itself). Note that entries in NameIndexes
/// which index just a single Compilation Unit are implicitly associated
/// with that unit, so this function will return 0 even without an explicit
/// DW_IDX_compile_unit attribute.
std::optional<uint64_t> getCUIndex() const;

View File

@ -187,7 +187,7 @@ public:
///
/// \param RegNum the register number to find a location for.
///
/// \returns A location if one is available for \a RegNum, or llvm::None
/// \returns A location if one is available for \a RegNum, or std::nullopt
/// otherwise.
std::optional<UnwindLocation> getRegisterLocation(uint32_t RegNum) const {
auto Pos = Locations.find(RegNum);

View File

@ -149,8 +149,8 @@ public:
///
/// \param Attrs an array of DWARF attribute to look for.
/// \returns an optional that has a valid DWARFFormValue for the first
/// matching attribute in Attrs, or None if none of the attributes in Attrs
/// exist in this DIE.
/// matching attribute in Attrs, or std::nullopt if none of the attributes in
/// Attrs exist in this DIE.
std::optional<DWARFFormValue> find(ArrayRef<dwarf::Attribute> Attrs) const;
/// Extract the first value of any attribute in Attrs from this DIE and
@ -159,9 +159,9 @@ public:
///
/// \param Attrs an array of DWARF attribute to look for.
/// \returns an optional that has a valid DWARFFormValue for the first
/// matching attribute in Attrs, or None if none of the attributes in Attrs
/// exist in this DIE or in any DW_AT_specification or DW_AT_abstract_origin
/// DIEs.
/// matching attribute in Attrs, or std::nullopt if none of the attributes in
/// Attrs exist in this DIE or in any DW_AT_specification or
/// DW_AT_abstract_origin DIEs.
std::optional<DWARFFormValue>
findRecursively(ArrayRef<dwarf::Attribute> Attrs) const;

View File

@ -129,8 +129,8 @@ public:
///
/// \param Kind The kind of path to extract.
///
/// \returns A valid string value on success, or llvm::None if the form class
/// is not FC_Constant, or if the file index is not valid.
/// \returns A valid string value on success, or std::nullopt if the form
/// class is not FC_Constant, or if the file index is not valid.
std::optional<std::string>
getAsFile(DILineInfoSpecifier::FileLineInfoKind Kind) const;

View File

@ -137,7 +137,7 @@ public:
///
/// \param Index An index into the file table.
/// \returns An optional FileInfo that will be valid if the file index is
/// valid, or llvm::None if the file index is out of bounds,
/// valid, or std::nullopt if the file index is out of bounds,
std::optional<FileEntry> getFile(uint32_t Index) const {
if (Index < Files.size())
return Files[Index];
@ -204,7 +204,7 @@ public:
///
/// \param Index A index into the address table.
/// \returns A resolved virtual address for adddress in the address table
/// or llvm::None if Index is out of bounds.
/// or std::nullopt if Index is out of bounds.
std::optional<uint64_t> getAddress(size_t Index) const;
protected:
@ -236,7 +236,7 @@ protected:
///
/// \param Index An index into the AddrOffsets array.
/// \returns An virtual address that matches the original object file for the
/// address as the specified index, or llvm::None if Index is out of bounds.
/// address as the specified index, or std::nullopt if Index is out of bounds.
template <class T>
std::optional<uint64_t> addressForIndex(size_t Index) const {
ArrayRef<T> AIO = getAddrOffsets<T>();

View File

@ -169,7 +169,7 @@ public:
/// Return the first line entry if the line table isn't empty.
///
/// \returns An optional line entry with the first line entry if the line
/// table isn't empty, or llvm::None if the line table is emtpy.
/// table isn't empty, or std::nullopt if the line table is emtpy.
std::optional<LineEntry> first() const {
if (Lines.empty())
return std::nullopt;
@ -178,7 +178,7 @@ public:
/// Return the last line entry if the line table isn't empty.
///
/// \returns An optional line entry with the last line entry if the line
/// table isn't empty, or llvm::None if the line table is emtpy.
/// table isn't empty, or std::nullopt if the line table is emtpy.
std::optional<LineEntry> last() const {
if (Lines.empty())
return std::nullopt;

View File

@ -78,7 +78,7 @@ public:
/// Calling nextNode() may invalidate the contents of the node returned by the
/// previous call.
///
/// \returns the next markup node or None if none remain.
/// \returns the next markup node or std::nullopt if none remain.
std::optional<MarkupNode> nextNode();
bool isSGR(const MarkupNode &Node) const {

View File

@ -235,8 +235,8 @@ public:
/// Returns the minimum value for the vscale_range attribute.
unsigned getVScaleRangeMin() const;
/// Returns the maximum value for the vscale_range attribute or None when
/// unknown.
/// Returns the maximum value for the vscale_range attribute or std::nullopt
/// when unknown.
std::optional<unsigned> getVScaleRangeMax() const;
// Returns the unwind table kind.
@ -1105,8 +1105,8 @@ public:
/// invalid if the Kind is not present in the builder.
Attribute getAttribute(StringRef Kind) const;
/// Return raw (possibly packed/encoded) value of integer attribute or None if
/// not set.
/// Return raw (possibly packed/encoded) value of integer attribute or
/// std::nullopt if not set.
std::optional<uint64_t> getRawIntAttr(Attribute::AttrKind Kind) const;
/// Retrieve the alignment attribute, if it exists.
@ -1151,7 +1151,8 @@ public:
/// Retrieve the inalloca type.
Type *getInAllocaType() const { return getTypeAttr(Attribute::InAlloca); }
/// Retrieve the allocsize args, or None if the attribute does not exist.
/// Retrieve the allocsize args, or std::nullopt if the attribute does not
/// exist.
std::optional<std::pair<unsigned, std::optional<unsigned>>> getAllocSizeArgs()
const;

View File

@ -1213,7 +1213,7 @@ public:
/// Getelementptr form. Value* is only accepted for convenience;
/// all elements must be Constants.
///
/// \param InRangeIndex the inrange index if present or None.
/// \param InRangeIndex the inrange index if present or std::nullopt.
/// \param OnlyIfReducedTy see \a getWithOperands() docs.
static Constant *
getGetElementPtr(Type *Ty, Constant *C, ArrayRef<Constant *> IdxList,

View File

@ -860,8 +860,8 @@ public:
enum class Signedness { Signed, Unsigned };
/// Return the signedness of this type, or None if this type is neither
/// signed nor unsigned.
/// Return the signedness of this type, or std::nullopt if this type is
/// neither signed nor unsigned.
std::optional<Signedness> getSignedness() const;
static bool classof(const Metadata *MD) {
@ -2552,8 +2552,8 @@ public:
/// Determines the size of the variable's type.
std::optional<uint64_t> getSizeInBits() const;
/// Return the signedness of this variable's type, or None if this type is
/// neither signed nor unsigned.
/// Return the signedness of this variable's type, or std::nullopt if this
/// type is neither signed nor unsigned.
std::optional<DIBasicType::Signedness> getSignedness() const {
if (auto *BT = dyn_cast<DIBasicType>(getType()))
return BT->getSignedness();

View File

@ -393,8 +393,8 @@ public:
return SubclassOptionalData & IsInBounds;
}
/// Returns the offset of the index with an inrange attachment, or None if
/// none.
/// Returns the offset of the index with an inrange attachment, or
/// std::nullopt if none.
Optional<unsigned> getInRangeIndex() const {
if (SubclassOptionalData >> 1 == 0)
return std::nullopt;

View File

@ -40,8 +40,8 @@ public:
return getData().slice(Stream.Location.RVA, Stream.Location.DataSize);
}
/// Returns the raw contents of the stream of the given type, or None if the
/// file does not contain a stream of this type.
/// Returns the raw contents of the stream of the given type, or std::nullopt
/// if the file does not contain a stream of this type.
std::optional<ArrayRef<uint8_t>>
getRawStream(minidump::StreamType Type) const;

View File

@ -117,7 +117,7 @@ namespace sys {
///< If the array is empty, no redirections are performed.
///< Otherwise, the inferior process's stdin(0), stdout(1), and stderr(2)
///< will be redirected to the corresponding paths, if the optional path
///< is present (not \c llvm::None).
///< is present (not \c std::nullopt).
///< When an empty path is passed in, the corresponding file descriptor
///< will be disconnected (ie, /dev/null'd) in a portable way.
unsigned SecondsToWait = 0, ///< If non-zero, this specifies the amount

View File

@ -99,7 +99,7 @@ private:
} // namespace detail
/// Matches an llvm::Optional<T> with a value that conforms to an inner matcher.
/// To match llvm::None you could use Eq(llvm::None).
/// To match std::nullopt you could use Eq(std::nullopt).
template <class InnerMatcher>
detail::ValueIsMatcher<InnerMatcher> ValueIs(const InnerMatcher &ValueMatcher) {
return detail::ValueIsMatcher<InnerMatcher>(ValueMatcher);

View File

@ -225,7 +225,7 @@ SmallVector<Instruction *, 8> findDefsUsedOutsideOfLoop(Loop *L);
/// Find a combination of metadata ("llvm.loop.vectorize.width" and
/// "llvm.loop.vectorize.scalable.enable") for a loop and use it to construct a
/// ElementCount. If the metadata "llvm.loop.vectorize.width" cannot be found
/// then None is returned.
/// then std::nullopt is returned.
Optional<ElementCount>
getOptionalElementCountLoopAttribute(const Loop *TheLoop);
@ -309,8 +309,8 @@ void addStringMetadataToLoop(Loop *TheLoop, const char *MDString,
/// Returns a loop's estimated trip count based on branch weight metadata.
/// In addition if \p EstimatedLoopInvocationWeight is not null it is
/// initialized with weight of loop's latch leading to the exit.
/// Returns 0 when the count is estimated to be 0, or None when a meaningful
/// estimate can not be made.
/// Returns 0 when the count is estimated to be 0, or std::nullopt when a
/// meaningful estimate can not be made.
Optional<unsigned>
getLoopEstimatedTripCount(Loop *L,
unsigned *EstimatedLoopInvocationWeight = nullptr);

View File

@ -1543,10 +1543,10 @@ bool InstrRefBasedLDV::transferDebugInstrRef(MachineInstr &MI,
}
}
// We, we have a value number or None. Tell the variable value tracker about
// it. The rest of this LiveDebugValues implementation acts exactly the same
// for DBG_INSTR_REFs as DBG_VALUEs (just, the former can refer to values that
// aren't immediately available).
// We, we have a value number or std::nullopt. Tell the variable value tracker
// about it. The rest of this LiveDebugValues implementation acts exactly the
// same for DBG_INSTR_REFs as DBG_VALUEs (just, the former can refer to values
// that aren't immediately available).
DbgValueProperties Properties(Expr, false, false);
SmallVector<DbgOpID> DbgOpIDs;
if (NewID)

View File

@ -1127,11 +1127,11 @@ private:
uint64_t InstrNum;
/// Block where DBG_PHI occurred.
MachineBasicBlock *MBB;
/// The value number read by the DBG_PHI -- or None if it didn't refer to
/// a value.
/// The value number read by the DBG_PHI -- or std::nullopt if it didn't
/// refer to a value.
Optional<ValueIDNum> ValueRead;
/// Register/Stack location the DBG_PHI reads -- or None if it referred to
/// something unexpected.
/// Register/Stack location the DBG_PHI reads -- or std::nullopt if it
/// referred to something unexpected.
Optional<LocIdx> ReadLoc;
operator unsigned() const { return InstrNum; }
@ -1229,7 +1229,7 @@ private:
/// forming another mini-ssa problem to solve.
/// \p Here the position of a DBG_INSTR_REF seeking a machine value number
/// \p InstrNum Debug instruction number defined by DBG_PHI instructions.
/// \returns The machine value number at position Here, or None.
/// \returns The machine value number at position Here, or std::nullopt.
Optional<ValueIDNum> resolveDbgPHIs(MachineFunction &MF,
const ValueTable *MLiveOuts,
const ValueTable *MLiveIns,

View File

@ -716,7 +716,7 @@ DWARFDebugLine::ParsingState::handleSpecialOpcode(uint8_t Opcode,
}
/// Parse a ULEB128 using the specified \p Cursor. \returns the parsed value on
/// success, or None if \p Cursor is in a failing state.
/// success, or std::nullopt if \p Cursor is in a failing state.
template <typename T>
static std::optional<T> parseULEB128(DWARFDataExtractor &Data,
DataExtractor::Cursor &Cursor) {

View File

@ -110,7 +110,7 @@ void MarkupParser::flush() {
}
// Finds and returns the next valid markup element in the given line. Returns
// None if the line contains no valid elements.
// std::nullopt if the line contains no valid elements.
std::optional<MarkupNode> MarkupParser::parseElement(StringRef Line) {
while (true) {
// Find next element using begin and end markers.

View File

@ -265,16 +265,16 @@ private:
/// format.
ExpressionFormat ImplicitFormat;
/// Value of numeric variable, if defined, or None otherwise.
/// Value of numeric variable, if defined, or std::nullopt otherwise.
Optional<ExpressionValue> Value;
/// The input buffer's string from which Value was parsed, or None. See
/// comments on getStringValue for a discussion of the None case.
/// The input buffer's string from which Value was parsed, or std::nullopt.
/// See comments on getStringValue for a discussion of the None case.
Optional<StringRef> StrValue;
/// Line number where this variable is defined, or None if defined before
/// input is parsed. Used to determine whether a variable is defined on the
/// same line as a given use.
/// Line number where this variable is defined, or std::nullopt if defined
/// before input is parsed. Used to determine whether a variable is defined on
/// the same line as a given use.
Optional<size_t> DefLineNumber;
public:
@ -296,9 +296,9 @@ public:
Optional<ExpressionValue> getValue() const { return Value; }
/// \returns the input buffer's string from which this variable's value was
/// parsed, or None if the value is not yet defined or was not parsed from the
/// input buffer. For example, the value of @LINE is not parsed from the
/// input buffer, and some numeric variables are parsed from the command
/// parsed, or std::nullopt if the value is not yet defined or was not parsed
/// from the input buffer. For example, the value of @LINE is not parsed from
/// the input buffer, and some numeric variables are parsed from the command
/// line instead.
Optional<StringRef> getStringValue() const { return StrValue; }
@ -318,8 +318,8 @@ public:
StrValue = std::nullopt;
}
/// \returns the line number where this variable is defined, if any, or None
/// if defined before input is parsed.
/// \returns the line number where this variable is defined, if any, or
/// std::nullopt if defined before input is parsed.
Optional<size_t> getDefLineNumber() const { return DefLineNumber; }
};
@ -672,9 +672,9 @@ class Pattern {
Check::FileCheckType CheckTy;
/// Line number for this CHECK pattern or None if it is an implicit pattern.
/// Used to determine whether a variable definition is made on an earlier
/// line to the one with this CHECK.
/// Line number for this CHECK pattern or std::nullopt if it is an implicit
/// pattern. Used to determine whether a variable definition is made on an
/// earlier line to the one with this CHECK.
Optional<size_t> LineNumber;
/// Ignore case while matching if set to true.
@ -717,7 +717,7 @@ public:
/// holding a diagnostic against \p SM if parsing fails. If substitution was
/// successful, sets \p DefinedNumericVariable to point to the class
/// representing the numeric variable defined in this numeric substitution
/// block, or None if this block does not define any variable.
/// block, or std::nullopt if this block does not define any variable.
static Expected<std::unique_ptr<Expression>> parseNumericSubstitutionBlock(
StringRef Expr, Optional<NumericVariable *> &DefinedNumericVariable,
bool IsLegacyLineExpr, Optional<size_t> LineNumber,

View File

@ -689,7 +689,8 @@ static Optional<unsigned> findMainViewFileID(const FunctionRecord &Function) {
}
/// Check if SourceFile is the file that contains the definition of
/// the Function. Return the ID of the file in that case or None otherwise.
/// the Function. Return the ID of the file in that case or std::nullopt
/// otherwise.
static Optional<unsigned> findMainViewFileID(StringRef SourceFile,
const FunctionRecord &Function) {
Optional<unsigned> I = findMainViewFileID(Function);

View File

@ -37,8 +37,8 @@ class AArch64CompressJumpTables : public MachineFunctionPass {
MachineFunction *MF;
SmallVector<int, 8> BlockInfo;
/// Returns the size in instructions of the block \p MBB, or None if we
/// couldn't get a safe upper bound.
/// Returns the size in instructions of the block \p MBB, or std::nullopt if
/// we couldn't get a safe upper bound.
std::optional<int> computeBlockSize(MachineBasicBlock &MBB);
/// Gather information about the function, returns false if we can't perform

View File

@ -1237,7 +1237,7 @@ bool isLegalSMRDEncodedSignedOffset(const MCSubtargetInfo &ST,
uint64_t convertSMRDOffsetUnits(const MCSubtargetInfo &ST, uint64_t ByteOffset);
/// \returns The encoding that will be used for \p ByteOffset in the
/// SMRD offset field, or None if it won't fit. On GFX9 and GFX10
/// SMRD offset field, or std::nullopt if it won't fit. On GFX9 and GFX10
/// S_LOAD instructions have a signed offset, on other subtargets it is
/// unsigned. S_BUFFER has an unsigned offset for all subtargets.
Optional<int64_t> getSMRDEncodedOffset(const MCSubtargetInfo &ST,

View File

@ -191,10 +191,10 @@ void PPCELFStreamer::emitGOTToPCRelLabel(const MCInst &Inst) {
// <MCInst SOME_LOAD <MCOperand Reg:22> <MCOperand Imm:0> <MCOperand Reg:282>
// <MCOperand Expr:(.Lpcrel@<<invalid>>)>>
// The above is a pair of such instructions and this function will not return
// None for either one of them. In both cases we are looking for the last
// operand <MCOperand Expr:(.Lpcrel@<<invalid>>)> which needs to be an MCExpr
// and has the flag MCSymbolRefExpr::VK_PPC_PCREL_OPT. After that we just look
// at the opcode and in the case of PLDpc we will return true. For the load
// std::nullopt for either one of them. In both cases we are looking for the
// last operand <MCOperand Expr:(.Lpcrel@<<invalid>>)> which needs to be an
// MCExpr and has the flag MCSymbolRefExpr::VK_PPC_PCREL_OPT. After that we just
// look at the opcode and in the case of PLDpc we will return true. For the load
// (or store) this function will return false indicating it has found the second
// instruciton in the pair.
std::optional<bool> llvm::isPartOfGOTToPCRelPair(const MCInst &Inst,

View File

@ -55,7 +55,7 @@ public:
const DebugLoc &DL) const;
// Returns the index of the WebAssembly local to which the stack object
// FrameIndex in MF should be allocated, or None.
// FrameIndex in MF should be allocated, or std::nullopt.
static std::optional<unsigned> getLocalForStackObject(MachineFunction &MF,
int FrameIndex);

View File

@ -1074,8 +1074,8 @@ Attributor::getAssumedConstant(const IRPosition &IRP,
const AbstractAttribute &AA,
bool &UsedAssumedInformation) {
// First check all callbacks provided by outside AAs. If any of them returns
// a non-null value that is different from the associated value, or None, we
// assume it's simplified.
// a non-null value that is different from the associated value, or
// std::nullopt, we assume it's simplified.
for (auto &CB : SimplificationCallbacks.lookup(IRP)) {
Optional<Value *> SimplifiedV = CB(IRP, &AA, UsedAssumedInformation);
if (!SimplifiedV)
@ -1104,8 +1104,8 @@ Optional<Value *> Attributor::getAssumedSimplified(const IRPosition &IRP,
bool &UsedAssumedInformation,
AA::ValueScope S) {
// First check all callbacks provided by outside AAs. If any of them returns
// a non-null value that is different from the associated value, or None, we
// assume it's simplified.
// a non-null value that is different from the associated value, or
// std::nullopt, we assume it's simplified.
for (auto &CB : SimplificationCallbacks.lookup(IRP))
return CB(IRP, AA, UsedAssumedInformation);
@ -1128,8 +1128,8 @@ bool Attributor::getAssumedSimplifiedValues(
SmallVectorImpl<AA::ValueAndContext> &Values, AA::ValueScope S,
bool &UsedAssumedInformation) {
// First check all callbacks provided by outside AAs. If any of them returns
// a non-null value that is different from the associated value, or None, we
// assume it's simplified.
// a non-null value that is different from the associated value, or
// std::nullopt, we assume it's simplified.
const auto &SimplificationCBs = SimplificationCallbacks.lookup(IRP);
for (const auto &CB : SimplificationCBs) {
Optional<Value *> CBResult = CB(IRP, AA, UsedAssumedInformation);

View File

@ -9617,7 +9617,7 @@ private:
Unreachable.erase(&Fn);
}
/// If there is no information about the function None is returned.
/// If there is no information about the function std::nullopt is returned.
Optional<bool> isCachedReachable(const Function &Fn) {
// Assume that we can reach the function.
// TODO: Be more specific with the unknown callee.

View File

@ -1171,8 +1171,8 @@ static hash_code encodePHINodeData(PHINodeData &PND) {
/// \param PN - The PHINode we are analyzing.
/// \param Blocks - The blocks for the region we are analyzing.
/// \param AggArgIdx - The argument \p PN will be stored into.
/// \returns An optional holding the assigned canonical number, or None if
/// there is some attribute of the PHINode blocking it from being used.
/// \returns An optional holding the assigned canonical number, or std::nullopt
/// if there is some attribute of the PHINode blocking it from being used.
static Optional<unsigned> getGVNForPHINode(OutlinableRegion &Region,
PHINode *PN,
DenseSet<BasicBlock *> &Blocks,

View File

@ -481,7 +481,8 @@ void ScalarizerVisitor::transferMetadataAndIRFlags(Instruction *Op,
}
// Try to fill in Layout from Ty, returning true on success. Alignment is
// the alignment of the vector, or None if the ABI default should be used.
// the alignment of the vector, or std::nullopt if the ABI default should be
// used.
Optional<VectorLayout>
ScalarizerVisitor::getVectorLayout(Type *Ty, Align Alignment,
const DataLayout &DL) {

View File

@ -295,8 +295,8 @@ public:
: OrigLoop(L), LI(LI), TLI(TLI), TTI(TTI), Legal(Legal), CM(CM), IAI(IAI),
PSE(PSE), Hints(Hints), ORE(ORE) {}
/// Plan how to best vectorize, return the best VF and its cost, or None if
/// vectorization and interleaving should be avoided up front.
/// Plan how to best vectorize, return the best VF and its cost, or
/// std::nullopt if vectorization and interleaving should be avoided up front.
Optional<VectorizationFactor> plan(ElementCount UserVF, unsigned UserIC);
/// Use the VPlan-native path to plan how to best vectorize, return the best