mirror of
https://github.com/intel/llvm.git
synced 2026-01-29 04:16:38 +08:00
mlir/DialectConversion: use std::optional (NFC)
This is part of an effort to migrate from llvm::Optional to std::optional. This patch touches DialectConversion, and modifies existing conversions and tests appropriately. See also: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716 Signed-off-by: Ramkumar Ramachandra <r@artagnon.com> Differential Revision: https://reviews.llvm.org/D140303
This commit is contained in:
@@ -178,7 +178,7 @@ static void createPushback(OpBuilder &builder, Location loc,
|
||||
}
|
||||
|
||||
/// Maps a sparse tensor type to the appropriate compounded buffers.
|
||||
static Optional<LogicalResult>
|
||||
static std::optional<LogicalResult>
|
||||
convertSparseTensorType(Type type, SmallVectorImpl<Type> &fields) {
|
||||
auto enc = getSparseTensorEncoding(type);
|
||||
if (!enc)
|
||||
@@ -1039,7 +1039,7 @@ mlir::SparseTensorTypeToBufferConverter::SparseTensorTypeToBufferConverter() {
|
||||
// Required by scf.for 1:N type conversion.
|
||||
addSourceMaterialization([](OpBuilder &builder, RankedTensorType tp,
|
||||
ValueRange inputs,
|
||||
Location loc) -> Optional<Value> {
|
||||
Location loc) -> std::optional<Value> {
|
||||
if (!getSparseTensorEncoding(tp))
|
||||
// Not a sparse tensor.
|
||||
return std::nullopt;
|
||||
|
||||
Reference in New Issue
Block a user