diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h index 72abb5b3f1f94..ab9a48f3473c2 100644 --- a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h +++ b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h @@ -163,7 +163,7 @@ struct BufferResultsToOutParamsOpts { // Filter function; returns true if the function should be converted. // Defaults to true, i.e. all functions are converted. - llvm::function_ref filterFn = [](func::FuncOp *func) { + std::function filterFn = [](func::FuncOp *func) { return true; }; diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp index 6678878215c11..a07593be2fc5e 100644 --- a/mlir/lib/Dialect/SCF/IR/SCF.cpp +++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp @@ -1084,13 +1084,12 @@ struct ForOpTensorCastFolder : public OpRewritePattern { continue; // Create a new ForOp with that iter operand replaced. - ValueTypeCastFnTy castFn = [](OpBuilder &b, Location loc, Type type, - Value source) { - return b.create(loc, type, source); - }; rewriter.replaceOp( - op, replaceAndCastForOpIterArg(rewriter, op, iterOpOperand, - incomingCast.getSource(), castFn)); + op, replaceAndCastForOpIterArg( + rewriter, op, iterOpOperand, incomingCast.getSource(), + [](OpBuilder &b, Location loc, Type type, Value source) { + return b.create(loc, type, source); + })); return success(); } return failure(); diff --git a/mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp b/mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp index a2acf3e732ada..c5610ba5d3c0b 100644 --- a/mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp +++ b/mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp @@ -319,9 +319,8 @@ ConstantIntRanges mlir::intrange::inferCeilDivU(ArrayRef argRanges) { const ConstantIntRanges &lhs = argRanges[0], &rhs = argRanges[1]; - DivisionFixupFn ceilDivUIFix = - [](const APInt &lhs, const APInt &rhs, - const APInt &result) -> std::optional { + auto ceilDivUIFix = [](const APInt &lhs, const APInt &rhs, + const APInt &result) -> std::optional { if (!lhs.urem(rhs).isZero()) { bool overflowed = false; APInt corrected = @@ -368,9 +367,8 @@ ConstantIntRanges mlir::intrange::inferCeilDivS(ArrayRef argRanges) { const ConstantIntRanges &lhs = argRanges[0], &rhs = argRanges[1]; - DivisionFixupFn ceilDivSIFix = - [](const APInt &lhs, const APInt &rhs, - const APInt &result) -> std::optional { + auto ceilDivSIFix = [](const APInt &lhs, const APInt &rhs, + const APInt &result) -> std::optional { if (!lhs.srem(rhs).isZero() && lhs.isNonNegative() == rhs.isNonNegative()) { bool overflowed = false; APInt corrected = @@ -386,9 +384,8 @@ ConstantIntRanges mlir::intrange::inferFloorDivS(ArrayRef argRanges) { const ConstantIntRanges &lhs = argRanges[0], &rhs = argRanges[1]; - DivisionFixupFn floorDivSIFix = - [](const APInt &lhs, const APInt &rhs, - const APInt &result) -> std::optional { + auto floorDivSIFix = [](const APInt &lhs, const APInt &rhs, + const APInt &result) -> std::optional { if (!lhs.srem(rhs).isZero() && lhs.isNonNegative() != rhs.isNonNegative()) { bool overflowed = false; APInt corrected = @@ -603,8 +600,7 @@ ConstantIntRanges mlir::intrange::inferShrS(ArrayRef argRanges) { const ConstantIntRanges &lhs = argRanges[0], &rhs = argRanges[1]; - ConstArithFn ashr = [](const APInt &l, - const APInt &r) -> std::optional { + auto ashr = [](const APInt &l, const APInt &r) -> std::optional { return r.uge(r.getBitWidth()) ? std::optional() : l.ashr(r); }; @@ -616,8 +612,7 @@ ConstantIntRanges mlir::intrange::inferShrU(ArrayRef argRanges) { const ConstantIntRanges &lhs = argRanges[0], &rhs = argRanges[1]; - ConstArithFn lshr = [](const APInt &l, - const APInt &r) -> std::optional { + auto lshr = [](const APInt &l, const APInt &r) -> std::optional { return r.uge(r.getBitWidth()) ? std::optional() : l.lshr(r); }; return minMaxBy(lshr, {lhs.umin(), lhs.umax()}, {rhs.umin(), rhs.umax()},