diff --git a/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp b/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp @@ -242,7 +242,7 @@ /// - modified index map that can be used to access the replaced result/operand /// - the reassociation that converts from the original tensor type to the /// modified tensor type. -static llvm::Optional +static std::optional replaceUnitExtents(GenericOp genericOp, OpOperand *opOperand, MLIRContext *context) { AffineMap indexingMap = genericOp.getMatchingIndexingMap(opOperand); diff --git a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp @@ -57,14 +57,14 @@ /// Return true if op1 and op2 are the same constant or the same SSA value. static bool isEqualOffsetSizeOrStride(OpFoldResult op1, OpFoldResult op2) { - auto getConstantIntValue = [](OpFoldResult ofr) -> llvm::Optional { + auto getConstantIntValue = [](OpFoldResult ofr) -> std::optional { Attribute attr = ofr.dyn_cast(); // Note: isa+cast-like pattern allows writing the condition below as 1 line. if (!attr && ofr.get().getDefiningOp()) attr = ofr.get().getDefiningOp().getValue(); if (auto intAttr = attr.dyn_cast_or_null()) return intAttr.getValue().getSExtValue(); - return llvm::None; + return std::nullopt; }; auto cst1 = getConstantIntValue(op1), cst2 = getConstantIntValue(op2); if (cst1 && cst2 && *cst1 == *cst2)