From: Quentin Colombet Date: Mon, 13 Feb 2023 09:18:19 +0000 (+0100) Subject: [mlir][LinAlgTransformOps][NFC] Use emitSilenceableError X-Git-Tag: upstream/17.0.6~17754 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a028cc8ffa551f720aae08445485157df2d23d4;p=platform%2Fupstream%2Fllvm.git [mlir][LinAlgTransformOps][NFC] Use emitSilenceableError Update the error reporting to the easier to use "emitSilenceableError" NFC --- diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp index 6e64d71..670fff4 100644 --- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp +++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp @@ -665,9 +665,8 @@ transform::FuseIntoContainingOp::apply(transform::TransformResults &results, while (!remainingProducers.empty()) { auto nextProducer = getNextProducer(); if (failed(nextProducer)) { - Diagnostic diag(containingOp->getLoc(), DiagnosticSeverity::Remark); - diag << "could not find next producer to fuse into container"; - return DiagnosedSilenceableFailure::silenceableFailure(std::move(diag)); + return mlir::emitSilenceableFailure(containingOp->getLoc()) + << "could not find next producer to fuse into container"; } Operation *producerOp = *nextProducer; @@ -886,9 +885,8 @@ DiagnosedSilenceableFailure transform::LowerPackOp::applyToOne( rewriter.setInsertionPoint(target); FailureOr res = lowerPack(rewriter, target); if (failed(res)) { - Diagnostic diag(target->getLoc(), DiagnosticSeverity::Error); - diag << "cannot lower to pad + expand + transpose"; - return DiagnosedSilenceableFailure::silenceableFailure(std::move(diag)); + return mlir::emitSilenceableFailure(target->getLoc()) + << "cannot lower to pad + expand + transpose"; } transformResults.push_back(res->padOp); transformResults.push_back(res->expandShapeOp); @@ -996,9 +994,8 @@ DiagnosedSilenceableFailure transform::LowerUnPackOp::applyToOne( rewriter.setInsertionPoint(target); FailureOr res = lowerUnPack(rewriter, target); if (failed(res)) { - Diagnostic diag(target->getLoc(), DiagnosticSeverity::Error); - diag << "cannot rewrite to pad + expand + transpose"; - return DiagnosedSilenceableFailure::silenceableFailure(std::move(diag)); + return mlir::emitSilenceableFailure(target->getLoc()) + << "cannot rewrite to pad + expand + transpose"; } transformResults.push_back(res->emptyOp); transformResults.push_back(res->transposeOp); @@ -2985,15 +2982,13 @@ DiagnosedSilenceableFailure transform::MaskedVectorizeOp::apply( for (Operation *target : targets) { auto linalgOp = dyn_cast(target); if (!linalgOp) { - Diagnostic diag(target->getLoc(), DiagnosticSeverity::Error); - diag << "cannot vectorize non-Linalg op"; - return DiagnosedSilenceableFailure::silenceableFailure(std::move(diag)); + return mlir::emitSilenceableFailure(target->getLoc()) + << "cannot vectorize non-Linalg op"; } if (failed(linalg::vectorize(rewriter, linalgOp, vectorSizes))) { - Diagnostic diag(target->getLoc(), DiagnosticSeverity::Error); - diag << "failed to vectorize op"; - return DiagnosedSilenceableFailure::silenceableFailure(std::move(diag)); + return mlir::emitSilenceableFailure(target->getLoc()) + << "failed to vectorize op"; } }