[mlir] 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:
parent
3c09ed006a
commit
70c73d1b72
|
@ -26,17 +26,19 @@ using MemorySpaceToStorageClassMap =
|
|||
std::function<Optional<spirv::StorageClass>(Attribute)>;
|
||||
|
||||
/// Maps MemRef memory spaces to storage classes for Vulkan-flavored SPIR-V
|
||||
/// using the default rule. Returns None if the memory space is unknown.
|
||||
/// using the default rule. Returns std::nullopt if the memory space is unknown.
|
||||
Optional<spirv::StorageClass> mapMemorySpaceToVulkanStorageClass(Attribute);
|
||||
/// Maps storage classes for Vulkan-flavored SPIR-V to MemRef memory spaces
|
||||
/// using the default rule. Returns None if the storage class is unsupported.
|
||||
/// using the default rule. Returns std::nullopt if the storage class is
|
||||
/// unsupported.
|
||||
Optional<unsigned> mapVulkanStorageClassToMemorySpace(spirv::StorageClass);
|
||||
|
||||
/// Maps MemRef memory spaces to storage classes for OpenCL-flavored SPIR-V
|
||||
/// using the default rule. Returns None if the memory space is unknown.
|
||||
/// using the default rule. Returns std::nullopt if the memory space is unknown.
|
||||
Optional<spirv::StorageClass> mapMemorySpaceToOpenCLStorageClass(Attribute);
|
||||
/// Maps storage classes for OpenCL-flavored SPIR-V to MemRef memory spaces
|
||||
/// using the default rule. Returns None if the storage class is unsupported.
|
||||
/// using the default rule. Returns std::nullopt if the storage class is
|
||||
/// unsupported.
|
||||
Optional<unsigned> mapOpenCLStorageClassToMemorySpace(spirv::StorageClass);
|
||||
|
||||
/// Type converter for converting numeric MemRef memory spaces into SPIR-V
|
||||
|
|
|
@ -110,7 +110,7 @@ struct ComputationSliceState {
|
|||
bool isEmpty() const { return ivs.empty(); }
|
||||
|
||||
/// Returns true if the computation slice encloses all the iterations of the
|
||||
/// sliced loop nest. Returns false if it does not. Returns llvm::None if it
|
||||
/// sliced loop nest. Returns false if it does not. Returns std::nullopt if it
|
||||
/// cannot determine if the slice is maximal or not.
|
||||
// TODO: Cache 'isMaximal' so that we don't recompute it when the slice
|
||||
// information hasn't changed.
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
return opView.get<Value>();
|
||||
}
|
||||
// Return the indexing map of the operand/result in `opView` specified in
|
||||
// the owning LinalgOp. If the owner is not a LinalgOp returns llvm::None.
|
||||
// the owning LinalgOp. If the owner is not a LinalgOp returns std::nullopt.
|
||||
static Optional<AffineMap> getIndexingMap(OpView opView) {
|
||||
auto owner = dyn_cast<LinalgOp>(getOwner(opView));
|
||||
if (!owner)
|
||||
|
@ -87,7 +87,7 @@ public:
|
|||
opView.get<Value>().cast<OpResult>().getResultNumber()));
|
||||
}
|
||||
// Return the operand number if the `opView` is an OpOperand *. Otherwise
|
||||
// return llvm::None.
|
||||
// return std::nullopt.
|
||||
static Optional<unsigned> getOperandNumber(OpView opView) {
|
||||
if (OpOperand *operand = opView.dyn_cast<OpOperand *>())
|
||||
return operand->getOperandNumber();
|
||||
|
@ -126,13 +126,13 @@ public:
|
|||
}
|
||||
|
||||
// If the dependent OpView is a result value, return the result
|
||||
// number. Return llvm::None otherwise.
|
||||
// number. Return std::nullopt otherwise.
|
||||
Optional<unsigned> getDependentOpViewResultNum() const {
|
||||
return getResultNumber(dependentOpView);
|
||||
}
|
||||
|
||||
// If the dependent OpView is a result value, return the result
|
||||
// number. Return llvm::None otherwise.
|
||||
// number. Return std::nullopt otherwise.
|
||||
Optional<unsigned> getIndexingOpViewResultNum() const {
|
||||
return getResultNumber(indexingOpView);
|
||||
}
|
||||
|
|
|
@ -50,8 +50,8 @@ LogicalResult foldMemRefCast(Operation *op, Value inner = nullptr);
|
|||
Type getTensorTypeFromMemRefType(Type type);
|
||||
|
||||
/// Finds a single dealloc operation for the given allocated value. If there
|
||||
/// are > 1 deallocates for `allocValue`, returns None, else returns the single
|
||||
/// deallocate if it exists or nullptr.
|
||||
/// are > 1 deallocates for `allocValue`, returns std::nullopt, else returns the
|
||||
/// single deallocate if it exists or nullptr.
|
||||
Optional<Operation *> findDealloc(Value allocValue);
|
||||
|
||||
} // namespace memref
|
||||
|
|
|
@ -273,7 +273,7 @@ def ForOp : SCF_Op<"for",
|
|||
return getOperation()->getNumOperands() - getNumControlOperands();
|
||||
}
|
||||
/// Get the iter arg number for an operand. If it isnt an iter arg
|
||||
/// operand return llvm::None.
|
||||
/// operand return std::nullopt.
|
||||
Optional<unsigned> getIterArgNumberForOpOperand(OpOperand &opOperand) {
|
||||
if (opOperand.getOwner() != getOperation())
|
||||
return std::nullopt;
|
||||
|
|
|
@ -34,13 +34,13 @@ public:
|
|||
/// Returns true if the given capability is allowed.
|
||||
bool allows(Capability) const;
|
||||
/// Returns the first allowed one if any of the given capabilities is allowed.
|
||||
/// Returns llvm::None otherwise.
|
||||
/// Returns std::nullopt otherwise.
|
||||
Optional<Capability> allows(ArrayRef<Capability>) const;
|
||||
|
||||
/// Returns true if the given extension is allowed.
|
||||
bool allows(Extension) const;
|
||||
/// Returns the first allowed one if any of the given extensions is allowed.
|
||||
/// Returns llvm::None otherwise.
|
||||
/// Returns std::nullopt otherwise.
|
||||
Optional<Extension> allows(ArrayRef<Extension>) const;
|
||||
|
||||
/// Returns the vendor ID.
|
||||
|
|
|
@ -44,16 +44,17 @@ SmallVector<int64_t> computeElementwiseMul(ArrayRef<int64_t> v1,
|
|||
/// Compute and return the multi-dimensional integral ratio of `subShape` to
|
||||
/// the trailing dimensions of `shape`. This represents how many times
|
||||
/// `subShape` fits within `shape`.
|
||||
/// If integral division is not possible, return None.
|
||||
/// If integral division is not possible, return std::nullopt.
|
||||
/// The trailing `subShape.size()` entries of both shapes are assumed (and
|
||||
/// enforced) to only contain noonnegative values.
|
||||
///
|
||||
/// Examples:
|
||||
/// - shapeRatio({3, 5, 8}, {2, 5, 2}) returns {3, 2, 1}.
|
||||
/// - shapeRatio({3, 8}, {2, 5, 2}) returns None (subshape has higher rank).
|
||||
/// - shapeRatio({3, 8}, {2, 5, 2}) returns std::nullopt (subshape has higher
|
||||
/// rank).
|
||||
/// - shapeRatio({42, 2, 10, 32}, {2, 5, 2}) returns {42, 1, 2, 16} which is
|
||||
/// derived as {42(leading shape dim), 2/2, 10/5, 32/2}.
|
||||
/// - shapeRatio({42, 2, 11, 32}, {2, 5, 2}) returns None which is
|
||||
/// - shapeRatio({42, 2, 11, 32}, {2, 5, 2}) returns std::nullopt which is
|
||||
/// derived as {42(leading shape dim), 2/2, 11/5(not divisible), 32/2}.
|
||||
Optional<SmallVector<int64_t>> computeShapeRatio(ArrayRef<int64_t> shape,
|
||||
ArrayRef<int64_t> subShape);
|
||||
|
|
|
@ -64,7 +64,7 @@ SmallVector<ReassociationIndices, 2> convertReassociationMapsToIndices(
|
|||
OpBuilder &b, ArrayRef<ReassociationExprs> reassociationExprs);
|
||||
|
||||
/// Return the reassociations maps to use to reshape given the source type and
|
||||
/// the target type when possible. Return llvm::None when this computation
|
||||
/// the target type when possible. Return std::nullopt when this computation
|
||||
/// failed.
|
||||
Optional<SmallVector<ReassociationIndices>>
|
||||
getReassociationIndicesForReshape(ShapedType sourceType, ShapedType targetType);
|
||||
|
|
|
@ -393,7 +393,7 @@ def ElementsAttrInterface : AttrInterface<"ElementsAttr"> {
|
|||
// Failable Value Iteration
|
||||
|
||||
/// If this attribute supports iterating over element values of type `T`,
|
||||
/// return the iterable range. Otherwise, return llvm::None.
|
||||
/// return the iterable range. Otherwise, return std::nullopt.
|
||||
template <typename T>
|
||||
DefaultValueCheckT<T, Optional<iterator_range<T>>> tryGetValues() const {
|
||||
if (Optional<iterator<T>> beginIt = try_value_begin<T>())
|
||||
|
@ -404,7 +404,7 @@ def ElementsAttrInterface : AttrInterface<"ElementsAttr"> {
|
|||
DefaultValueCheckT<T, Optional<iterator<T>>> try_value_begin() const;
|
||||
|
||||
/// If this attribute supports iterating over element values of type `T`,
|
||||
/// return the iterable range. Otherwise, return llvm::None.
|
||||
/// return the iterable range. Otherwise, return std::nullopt.
|
||||
template <typename T, typename = DerivedAttrValueCheckT<T>>
|
||||
Optional<DerivedAttrValueIteratorRange<T>> tryGetValues() const {
|
||||
auto values = tryGetValues<Attribute>();
|
||||
|
|
|
@ -784,7 +784,7 @@ public:
|
|||
get(ShapedType type, StringRef blobName, AsmResourceBlob blob);
|
||||
|
||||
/// Return the data of this attribute as an ArrayRef<T> if it is present,
|
||||
/// returns None otherwise.
|
||||
/// returns std::nullopt otherwise.
|
||||
Optional<ArrayRef<T>> tryGetAsArrayRef() const;
|
||||
|
||||
/// Support for isa<>/cast<>.
|
||||
|
|
|
@ -576,7 +576,7 @@ def Builtin_DictionaryAttr : Builtin_Attr<"Dictionary", [
|
|||
static bool sortInPlace(SmallVectorImpl<NamedAttribute> &array);
|
||||
|
||||
/// Returns an entry with a duplicate name in `array`, if it exists, else
|
||||
/// returns llvm::None. If `isSorted` is true, the array is assumed to be
|
||||
/// returns std::nullopt. If `isSorted` is true, the array is assumed to be
|
||||
/// sorted else it will be sorted in place before finding the duplicate entry.
|
||||
static Optional<NamedAttribute>
|
||||
findDuplicate(SmallVectorImpl<NamedAttribute> &array, bool isSorted);
|
||||
|
|
|
@ -335,8 +335,8 @@ private:
|
|||
/// `reducedShape`. The returned mask can be applied as a projection to
|
||||
/// `originalShape` to obtain the `reducedShape`. This mask is useful to track
|
||||
/// which dimensions must be kept when e.g. compute MemRef strides under
|
||||
/// rank-reducing operations. Return None if reducedShape cannot be obtained
|
||||
/// by dropping only `1` entries in `originalShape`.
|
||||
/// rank-reducing operations. Return std::nullopt if reducedShape cannot be
|
||||
/// obtained by dropping only `1` entries in `originalShape`.
|
||||
llvm::Optional<llvm::SmallDenseSet<unsigned>>
|
||||
computeRankReductionMask(ArrayRef<int64_t> originalShape,
|
||||
ArrayRef<int64_t> reducedShape);
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
OperationName getName() { return name; }
|
||||
|
||||
/// If this operation has a registered operation description, return it.
|
||||
/// Otherwise return None.
|
||||
/// Otherwise return std::nullopt.
|
||||
Optional<RegisteredOperationName> getRegisteredInfo() {
|
||||
return getName().getRegisteredInfo();
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ inline llvm::hash_code hash_value(OperationName arg) {
|
|||
class RegisteredOperationName : public OperationName {
|
||||
public:
|
||||
/// Lookup the registered operation information for the given operation.
|
||||
/// Returns None if the operation isn't registered.
|
||||
/// Returns std::nullopt if the operation isn't registered.
|
||||
static Optional<RegisteredOperationName> lookup(StringRef name,
|
||||
MLIRContext *ctx);
|
||||
|
||||
|
@ -464,8 +464,8 @@ Attribute getAttrFromSortedRange(IteratorT first, IteratorT last, NameT name) {
|
|||
return result.second ? result.first->getValue() : Attribute();
|
||||
}
|
||||
|
||||
/// Get an attribute from a sorted range of named attributes. Returns None if
|
||||
/// the attribute was not found.
|
||||
/// Get an attribute from a sorted range of named attributes. Returns
|
||||
/// std::nullopt if the attribute was not found.
|
||||
template <typename IteratorT, typename NameT>
|
||||
Optional<NamedAttribute>
|
||||
getNamedAttrFromSortedRange(IteratorT first, IteratorT last, NameT name) {
|
||||
|
@ -554,7 +554,7 @@ public:
|
|||
void pop_back() { attrs.pop_back(); }
|
||||
|
||||
/// Returns an entry with a duplicate name the list, if it exists, else
|
||||
/// returns llvm::None.
|
||||
/// returns std::nullopt.
|
||||
Optional<NamedAttribute> findDuplicate() const;
|
||||
|
||||
/// Return a dictionary attribute for the underlying dictionary. This will
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
ArrayRef<OperationName> getGeneratedOps() const { return generatedOps; }
|
||||
|
||||
/// Return the root node that this pattern matches. Patterns that can match
|
||||
/// multiple root types return None.
|
||||
/// multiple root types return std::nullopt.
|
||||
Optional<OperationName> getRootKind() const {
|
||||
if (rootKind == RootKind::OperationName)
|
||||
return OperationName::getFromOpaquePointer(rootValue);
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
|
||||
/// Return the interface ID used to match the root operation of this pattern.
|
||||
/// If the pattern does not use an interface ID for deciding the root match,
|
||||
/// this returns None.
|
||||
/// this returns std::nullopt.
|
||||
Optional<TypeID> getRootInterfaceID() const {
|
||||
if (rootKind == RootKind::InterfaceID)
|
||||
return TypeID::getFromOpaquePointer(rootValue);
|
||||
|
@ -106,7 +106,7 @@ public:
|
|||
|
||||
/// Return the trait ID used to match the root operation of this pattern.
|
||||
/// If the pattern does not use a trait ID for deciding the root match, this
|
||||
/// returns None.
|
||||
/// returns std::nullopt.
|
||||
Optional<TypeID> getRootTraitID() const {
|
||||
if (rootKind == RootKind::TraitID)
|
||||
return TypeID::getFromOpaquePointer(rootValue);
|
||||
|
|
|
@ -179,15 +179,15 @@ public:
|
|||
|
||||
/// Get an iterator range for all of the uses, for any symbol, that are nested
|
||||
/// within the given operation 'from'. This does not traverse into any nested
|
||||
/// symbol tables. This function returns None if there are any unknown
|
||||
/// symbol tables. This function returns std::nullopt if there are any unknown
|
||||
/// operations that may potentially be symbol tables.
|
||||
static Optional<UseRange> getSymbolUses(Operation *from);
|
||||
static Optional<UseRange> getSymbolUses(Region *from);
|
||||
|
||||
/// Get all of the uses of the given symbol that are nested within the given
|
||||
/// operation 'from'. This does not traverse into any nested symbol tables.
|
||||
/// This function returns None if there are any unknown operations that may
|
||||
/// potentially be symbol tables.
|
||||
/// This function returns std::nullopt if there are any unknown operations
|
||||
/// that may potentially be symbol tables.
|
||||
static Optional<UseRange> getSymbolUses(StringAttr symbol, Operation *from);
|
||||
static Optional<UseRange> getSymbolUses(Operation *symbol, Operation *from);
|
||||
static Optional<UseRange> getSymbolUses(StringAttr symbol, Region *from);
|
||||
|
|
|
@ -135,8 +135,8 @@ public:
|
|||
///
|
||||
/// LogicalResult(Operation *op, Attribute attr, StringRef attrName);
|
||||
///
|
||||
/// If a uniqued constraint was not found, this function returns None. The
|
||||
/// uniqued constraints cannot be used in the context of an OpAdaptor.
|
||||
/// If a uniqued constraint was not found, this function returns std::nullopt.
|
||||
/// The uniqued constraints cannot be used in the context of an OpAdaptor.
|
||||
///
|
||||
/// Pattern constraints have the form:
|
||||
///
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
bool isVariableLength() const { return isOptional() || isVariadic(); }
|
||||
|
||||
// Returns the builder call for this constraint if this is a buildable type,
|
||||
// returns None otherwise.
|
||||
// returns std::nullopt otherwise.
|
||||
Optional<StringRef> getBuilderCall() const;
|
||||
|
||||
// Return the C++ class name for this type (which may just be ::mlir::Type).
|
||||
|
|
|
@ -668,7 +668,7 @@ public:
|
|||
void setDocComment(Context &ctx, StringRef comment);
|
||||
|
||||
/// Return the documentation comment attached to this decl if it has been set.
|
||||
/// Otherwise, returns None.
|
||||
/// Otherwise, returns std::nullopt.
|
||||
Optional<StringRef> getDocComment() const { return docComment; }
|
||||
|
||||
protected:
|
||||
|
@ -901,8 +901,8 @@ public:
|
|||
return const_cast<UserConstraintDecl *>(this)->getInputs();
|
||||
}
|
||||
|
||||
/// Return the explicit native type to use for the given input. Returns None
|
||||
/// if no explicit type was set.
|
||||
/// Return the explicit native type to use for the given input. Returns
|
||||
/// std::nullopt if no explicit type was set.
|
||||
Optional<StringRef> getNativeInputType(unsigned index) const;
|
||||
|
||||
/// Return the explicit results of the constraint declaration. May be empty,
|
||||
|
|
|
@ -834,8 +834,8 @@ public:
|
|||
|
||||
/// If the given operation instance is legal on this target, a structure
|
||||
/// containing legality information is returned. If the operation is not
|
||||
/// legal, None is returned. Also returns None is operation legality wasn't
|
||||
/// registered by user or dynamic legality callbacks returned None.
|
||||
/// legal, std::nullopt is returned. Also returns None is operation legality
|
||||
/// wasn't registered by user or dynamic legality callbacks returned None.
|
||||
///
|
||||
/// Note: Legality is actually a 4-state: Legal(recursive=true),
|
||||
/// Legal(recursive=false), Illegal or Unknown, where Unknown is treated
|
||||
|
|
|
@ -1325,7 +1325,7 @@ MaybeOptimum<Fraction> Simplex::computeRowOptimum(Direction direction,
|
|||
// Keep trying to find a pivot for the row in the specified direction.
|
||||
while (Optional<Pivot> maybePivot = findPivot(row, direction)) {
|
||||
// If findPivot returns a pivot involving the row itself, then the optimum
|
||||
// is unbounded, so we return None.
|
||||
// is unbounded, so we return std::nullopt.
|
||||
if (maybePivot->row == row)
|
||||
return OptimumKind::Unbounded;
|
||||
pivot(*maybePivot);
|
||||
|
@ -1610,7 +1610,7 @@ Optional<SmallVector<MPInt, 8>> Simplex::getSamplePointIfIntegral() const {
|
|||
SmallVector<MPInt, 8> integerSample;
|
||||
integerSample.reserve(var.size());
|
||||
for (const Fraction &coord : rationalSample) {
|
||||
// If the sample is non-integral, return None.
|
||||
// If the sample is non-integral, return std::nullopt.
|
||||
if (coord.num % coord.den != 0)
|
||||
return {};
|
||||
integerSample.push_back(coord.num / coord.den);
|
||||
|
|
|
@ -1166,8 +1166,8 @@ Attribute Parser::parseStridedLayoutAttr() {
|
|||
return nullptr;
|
||||
|
||||
// Parses either an integer token or a question mark token. Reports an error
|
||||
// and returns None if the current token is neither. The integer token must
|
||||
// fit into int64_t limits.
|
||||
// and returns std::nullopt if the current token is neither. The integer token
|
||||
// must fit into int64_t limits.
|
||||
auto parseStrideOrOffset = [&]() -> Optional<int64_t> {
|
||||
if (consumeIf(Token::question))
|
||||
return ShapedType::kDynamic;
|
||||
|
|
|
@ -24,7 +24,7 @@ SMLoc Token::getEndLoc() const {
|
|||
SMRange Token::getLocRange() const { return SMRange(getLoc(), getEndLoc()); }
|
||||
|
||||
/// For an integer token, return its value as an unsigned. If it doesn't fit,
|
||||
/// return None.
|
||||
/// return std::nullopt.
|
||||
Optional<unsigned> Token::getUnsignedIntegerValue() const {
|
||||
bool isHex = spelling.size() > 1 && spelling[1] == 'x';
|
||||
|
||||
|
@ -35,7 +35,7 @@ Optional<unsigned> Token::getUnsignedIntegerValue() const {
|
|||
}
|
||||
|
||||
/// For an integer token, return its value as a uint64_t. If it doesn't fit,
|
||||
/// return None.
|
||||
/// return std::nullopt.
|
||||
Optional<uint64_t> Token::getUInt64IntegerValue(StringRef spelling) {
|
||||
bool isHex = spelling.size() > 1 && spelling[1] == 'x';
|
||||
|
||||
|
@ -45,8 +45,8 @@ Optional<uint64_t> Token::getUInt64IntegerValue(StringRef spelling) {
|
|||
return result;
|
||||
}
|
||||
|
||||
/// For a floatliteral, return its value as a double. Return None if the value
|
||||
/// underflows or overflows.
|
||||
/// For a floatliteral, return its value as a double. Return std::nullopt if the
|
||||
/// value underflows or overflows.
|
||||
Optional<double> Token::getFloatingPointValue() const {
|
||||
double result = 0;
|
||||
if (spelling.getAsDouble(result))
|
||||
|
|
|
@ -74,18 +74,18 @@ public:
|
|||
// Helpers to decode specific sorts of tokens.
|
||||
|
||||
/// For an integer token, return its value as an unsigned. If it doesn't fit,
|
||||
/// return None.
|
||||
/// return std::nullopt.
|
||||
Optional<unsigned> getUnsignedIntegerValue() const;
|
||||
|
||||
/// For an integer token, return its value as an uint64_t. If it doesn't fit,
|
||||
/// return None.
|
||||
/// return std::nullopt.
|
||||
static Optional<uint64_t> getUInt64IntegerValue(StringRef spelling);
|
||||
Optional<uint64_t> getUInt64IntegerValue() const {
|
||||
return getUInt64IntegerValue(getSpelling());
|
||||
}
|
||||
|
||||
/// For a floatliteral token, return its value as a double. Returns None in
|
||||
/// the case of underflow or overflow.
|
||||
/// For a floatliteral token, return its value as a double. Returns
|
||||
/// std::nullopt in the case of underflow or overflow.
|
||||
Optional<double> getFloatingPointValue() const;
|
||||
|
||||
/// For an inttype token, return its bitwidth.
|
||||
|
|
|
@ -114,7 +114,7 @@ static bool isAllocationSupported(Operation *allocOp, MemRefType type) {
|
|||
|
||||
/// Returns the scope to use for atomic operations use for emulating store
|
||||
/// operations of unsupported integer bitwidths, based on the memref
|
||||
/// type. Returns None on failure.
|
||||
/// type. Returns std::nullopt on failure.
|
||||
static Optional<spirv::Scope> getAtomicOpScope(MemRefType type) {
|
||||
auto sc = type.getMemorySpace().dyn_cast_or_null<spirv::StorageClassAttr>();
|
||||
switch (sc.getValue()) {
|
||||
|
|
|
@ -283,7 +283,7 @@ Optional<bool> ComputationSliceState::isSliceValid() {
|
|||
}
|
||||
|
||||
/// Returns true if the computation slice encloses all the iterations of the
|
||||
/// sliced loop nest. Returns false if it does not. Returns llvm::None if it
|
||||
/// sliced loop nest. Returns false if it does not. Returns std::nullopt if it
|
||||
/// cannot determine if the slice is maximal or not.
|
||||
Optional<bool> ComputationSliceState::isMaximal() const {
|
||||
// Fast check to determine if the computation slice is maximal. If the result
|
||||
|
|
|
@ -17,7 +17,7 @@ using namespace mlir;
|
|||
using namespace mlir::arith;
|
||||
|
||||
/// Function that evaluates the result of doing something on arithmetic
|
||||
/// constants and returns None on overflow.
|
||||
/// constants and returns std::nullopt on overflow.
|
||||
using ConstArithFn =
|
||||
function_ref<Optional<APInt>(const APInt &, const APInt &)>;
|
||||
|
||||
|
|
|
@ -278,7 +278,7 @@ Optional<unsigned> mlir::LLVM::extractPointerSpecValue(Attribute attr,
|
|||
/// Returns the part of the data layout entry that corresponds to `pos` for the
|
||||
/// given `type` by interpreting the list of entries `params`. For the pointer
|
||||
/// type in the default address space, returns the default value if the entries
|
||||
/// do not provide a custom one, for other address spaces returns None.
|
||||
/// do not provide a custom one, for other address spaces returns std::nullopt.
|
||||
static Optional<unsigned>
|
||||
getPointerDataLayoutEntry(DataLayoutEntryListRef params, LLVMPointerType type,
|
||||
PtrDLEntryPos pos) {
|
||||
|
|
|
@ -48,7 +48,7 @@ llvm::Optional<Operation *> mlir::memref::findDealloc(Value allocValue) {
|
|||
for (Operation *user : allocValue.getUsers()) {
|
||||
if (!hasEffect<MemoryEffects::Free>(user, allocValue))
|
||||
continue;
|
||||
// If we found > 1 dealloc, return None.
|
||||
// If we found > 1 dealloc, return std::nullopt.
|
||||
if (dealloc)
|
||||
return std::nullopt;
|
||||
dealloc = user;
|
||||
|
|
|
@ -719,7 +719,7 @@ struct ForOpIterArgsFolder : public OpRewritePattern<scf::ForOp> {
|
|||
};
|
||||
|
||||
/// Util function that tries to compute a constant diff between u and l.
|
||||
/// Returns llvm::None when the difference between two AffineValueMap is
|
||||
/// Returns std::nullopt when the difference between two AffineValueMap is
|
||||
/// dynamic.
|
||||
static Optional<int64_t> computeConstDiff(Value l, Value u) {
|
||||
IntegerAttr clb, cub;
|
||||
|
|
|
@ -44,8 +44,8 @@ public:
|
|||
|
||||
//
|
||||
// Derived classes should provide the following method which performs the
|
||||
// actual conversion. It should return llvm::None upon conversion failure and
|
||||
// return the converted operation upon success.
|
||||
// actual conversion. It should return std::nullopt upon conversion failure
|
||||
// and return the converted operation upon success.
|
||||
//
|
||||
// Optional<SourceOp> convertSourceOp(SourceOp op, OpAdaptor adaptor,
|
||||
// ConversionPatternRewriter &rewriter,
|
||||
|
|
|
@ -82,7 +82,7 @@ static Type getRuntimeArrayElementType(Type type) {
|
|||
}
|
||||
|
||||
/// Given a list of resource element `types`, returns the index of the canonical
|
||||
/// resource that all resources should be unified into. Returns llvm::None if
|
||||
/// resource that all resources should be unified into. Returns std::nullopt if
|
||||
/// unable to unify.
|
||||
static Optional<int> deduceCanonicalResource(ArrayRef<spirv::SPIRVType> types) {
|
||||
// scalarNumBits: contains all resources' scalar types' bit counts.
|
||||
|
|
|
@ -115,7 +115,7 @@ static scf::ForOp createFor(OpBuilder &builder, Location loc, Value upper,
|
|||
}
|
||||
|
||||
/// Gets the dimension size for the given sparse tensor at the given
|
||||
/// original dimension 'dim'. Returns None if no sparse encoding is
|
||||
/// original dimension 'dim'. Returns std::nullopt if no sparse encoding is
|
||||
/// attached to the given tensor type.
|
||||
static Optional<Value> sizeFromTensorAtDim(OpBuilder &builder, Location loc,
|
||||
RankedTensorType tensorTp,
|
||||
|
|
|
@ -148,7 +148,7 @@ Type OpTrait::util::getBroadcastedType(Type type1, Type type2,
|
|||
}
|
||||
|
||||
// Returns the type kind if the given type is a vector or ranked tensor type.
|
||||
// Returns llvm::None otherwise.
|
||||
// Returns std::nullopt otherwise.
|
||||
auto getCompositeTypeKind = [](Type type) -> Optional<TypeID> {
|
||||
if (type.isa<VectorType, RankedTensorType>())
|
||||
return type.getTypeID();
|
||||
|
|
|
@ -132,8 +132,8 @@ static Operation *cloneOpWithOperandsAndTypes(OpBuilder &builder, Location loc,
|
|||
resultTypes, op->getAttrs());
|
||||
}
|
||||
|
||||
/// Return the target shape for unrolling for the given `op`. Return llvm::None
|
||||
/// if the op shouldn't be or cannot be unrolled.
|
||||
/// Return the target shape for unrolling for the given `op`. Return
|
||||
/// std::nullopt if the op shouldn't be or cannot be unrolled.
|
||||
static Optional<SmallVector<int64_t>>
|
||||
getTargetShape(const vector::UnrollVectorOptions &options, Operation *op) {
|
||||
if (options.filterConstraint && failed(options.filterConstraint(op)))
|
||||
|
|
|
@ -92,7 +92,7 @@ static bool dictionaryAttrSort(ArrayRef<NamedAttribute> value,
|
|||
}
|
||||
|
||||
/// Returns an entry with a duplicate name from the given sorted array of named
|
||||
/// attributes. Returns llvm::None if all elements have unique names.
|
||||
/// attributes. Returns std::nullopt if all elements have unique names.
|
||||
static Optional<NamedAttribute>
|
||||
findDuplicateElement(ArrayRef<NamedAttribute> value) {
|
||||
const Optional<NamedAttribute> none{std::nullopt};
|
||||
|
|
|
@ -385,8 +385,8 @@ unsigned BaseMemRefType::getMemorySpaceAsInt() const {
|
|||
/// `reducedShape`. The returned mask can be applied as a projection to
|
||||
/// `originalShape` to obtain the `reducedShape`. This mask is useful to track
|
||||
/// which dimensions must be kept when e.g. compute MemRef strides under
|
||||
/// rank-reducing operations. Return None if reducedShape cannot be obtained
|
||||
/// by dropping only `1` entries in `originalShape`.
|
||||
/// rank-reducing operations. Return std::nullopt if reducedShape cannot be
|
||||
/// obtained by dropping only `1` entries in `originalShape`.
|
||||
llvm::Optional<llvm::SmallDenseSet<unsigned>>
|
||||
mlir::computeRankReductionMask(ArrayRef<int64_t> originalShape,
|
||||
ArrayRef<int64_t> reducedShape) {
|
||||
|
|
|
@ -778,8 +778,8 @@ static Optional<SymbolTable::UseRange> getSymbolUsesImpl(SymbolT symbol,
|
|||
|
||||
/// Get all of the uses of the given symbol that are nested within the given
|
||||
/// operation 'from', invoking the provided callback for each. This does not
|
||||
/// traverse into any nested symbol tables. This function returns None if there
|
||||
/// are any unknown operations that may potentially be symbol tables.
|
||||
/// traverse into any nested symbol tables. This function returns std::nullopt
|
||||
/// if there are any unknown operations that may potentially be symbol tables.
|
||||
auto SymbolTable::getSymbolUses(StringAttr symbol, Operation *from)
|
||||
-> Optional<UseRange> {
|
||||
return getSymbolUsesImpl(symbol, from);
|
||||
|
|
|
@ -77,7 +77,7 @@ StringRef StaticVerifierFunctionEmitter::getTypeConstraintFn(
|
|||
}
|
||||
|
||||
// Find a uniqued attribute constraint. Since not all attribute constraints can
|
||||
// be uniqued, return None if one was not found.
|
||||
// be uniqued, return std::nullopt if one was not found.
|
||||
Optional<StringRef> StaticVerifierFunctionEmitter::getAttrConstraintFn(
|
||||
const Constraint &constraint) const {
|
||||
auto it = attrConstraints.find(constraint);
|
||||
|
|
|
@ -40,7 +40,7 @@ StringRef TypeConstraint::getVariadicOfVariadicSegmentSizeAttr() const {
|
|||
}
|
||||
|
||||
// Returns the builder call for this constraint if this is a buildable type,
|
||||
// returns None otherwise.
|
||||
// returns std::nullopt otherwise.
|
||||
Optional<StringRef> TypeConstraint::getBuilderCall() const {
|
||||
const llvm::Record *baseType = def;
|
||||
if (isVariableLength())
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace lsp {
|
|||
SMRange convertTokenLocToRange(SMLoc loc);
|
||||
|
||||
/// Extract a documentation comment for the given location within the source
|
||||
/// manager. Returns None if no comment could be computed.
|
||||
/// manager. Returns std::nullopt if no comment could be computed.
|
||||
Optional<std::string> extractSourceDocComment(llvm::SourceMgr &sourceMgr,
|
||||
SMLoc loc);
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ LogicalResult readLine(std::FILE *in, SmallVectorImpl<char> &out) {
|
|||
}
|
||||
}
|
||||
|
||||
// Returns None when:
|
||||
// Returns std::nullopt when:
|
||||
// - ferror(), feof(), or shutdownRequested() are set.
|
||||
// - Content-Length is missing or empty (protocol error)
|
||||
LogicalResult JSONTransport::readStandardMessage(std::string &json) {
|
||||
|
|
|
@ -153,7 +153,7 @@ static Optional<unsigned> getResultNumberFromLoc(SMLoc loc) {
|
|||
}
|
||||
|
||||
/// Given a source location range, return the text covered by the given range.
|
||||
/// If the range is invalid, returns None.
|
||||
/// If the range is invalid, returns std::nullopt.
|
||||
static Optional<StringRef> getTextFromRange(SMRange range) {
|
||||
if (!range.isValid())
|
||||
return std::nullopt;
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace mlir {
|
|||
namespace tblgen {
|
||||
class Dialect;
|
||||
|
||||
/// Find the dialect selected by the user to generate for. Returns None if no
|
||||
/// dialect was found, or if more than one potential dialect was found.
|
||||
/// Find the dialect selected by the user to generate for. Returns std::nullopt
|
||||
/// if no dialect was found, or if more than one potential dialect was found.
|
||||
Optional<Dialect> findDialectToGenerate(ArrayRef<Dialect> dialects);
|
||||
} // namespace tblgen
|
||||
} // namespace mlir
|
||||
|
|
|
@ -226,7 +226,7 @@ static void emitMaxValueFn(const Record &enumDef, raw_ostream &os) {
|
|||
os << "}\n\n";
|
||||
}
|
||||
|
||||
// Returns the EnumAttrCase whose value is zero if exists; returns llvm::None
|
||||
// Returns the EnumAttrCase whose value is zero if exists; returns std::nullopt
|
||||
// otherwise.
|
||||
static llvm::Optional<EnumAttrCase>
|
||||
getAllBitsUnsetCase(llvm::ArrayRef<EnumAttrCase> cases) {
|
||||
|
|
|
@ -2471,7 +2471,7 @@ static Optional<LogicalResult> checkRangeForElement(
|
|||
// We found a closing element that is valid.
|
||||
return success();
|
||||
}
|
||||
// Return None to indicate that we reached the end.
|
||||
// Return std::nullopt to indicate that we reached the end.
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,8 @@ static void dump(ArrayRef<MPInt> vec) {
|
|||
/// for the IntegerPolyhedron poly. Also check that getIntegerLexmin finds a
|
||||
/// non-empty lexmin.
|
||||
///
|
||||
/// If hasSample is false, check that findIntegerSample returns None and
|
||||
/// findIntegerLexMin returns Empty.
|
||||
/// If hasSample is false, check that findIntegerSample returns std::nullopt
|
||||
/// and findIntegerLexMin returns Empty.
|
||||
///
|
||||
/// If fn is TestFunction::Empty, check that isIntegerEmpty returns the
|
||||
/// opposite of hasSample.
|
||||
|
|
Loading…
Reference in New Issue