[mlir] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
This commit is contained in:
Kazu Hirata
2022-12-03 18:50:27 -08:00
parent 1d650d4f1d
commit 1a36588ec6
197 changed files with 594 additions and 581 deletions

View File

@@ -948,9 +948,9 @@ computeContiguousStrides(MemRefType memRefType) {
int64_t offset;
SmallVector<int64_t, 4> strides;
if (failed(getStridesAndOffset(memRefType, strides, offset)))
return None;
return std::nullopt;
if (!strides.empty() && strides.back() != 1)
return None;
return std::nullopt;
// If no layout or identity layout, this is contiguous by definition.
if (memRefType.getLayout().isIdentity())
return strides;
@@ -964,9 +964,9 @@ computeContiguousStrides(MemRefType memRefType) {
if (ShapedType::isDynamic(sizes[index + 1]) ||
ShapedType::isDynamic(strides[index]) ||
ShapedType::isDynamic(strides[index + 1]))
return None;
return std::nullopt;
if (strides[index] != strides[index + 1] * sizes[index + 1])
return None;
return std::nullopt;
}
return strides;
}