[llvm-branch-commits] [mlir] [mlir][Transforms][NFC] Dialect Conversion: Simplify `finalize` signature (PR #110419)
Matthias Springer via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Sep 29 02:58:55 PDT 2024
https://github.com/matthias-springer created https://github.com/llvm/llvm-project/pull/110419
This commit simplifies the signature of `OperationConverter::finalize`. This function always returns "success", so the return value can be removed.
Note: Previously, this function used to return "failure" if a materialization failed to legalize. This is now optional and happening at a later point of time (see `config.buildMaterializations`).
Depends on #110414.
>From 95a23ba2b91f3fa58fa77eec1981feb922b3a201 Mon Sep 17 00:00:00 2001
From: Matthias Springer <mspringer at nvidia.com>
Date: Sun, 29 Sep 2024 11:55:37 +0200
Subject: [PATCH] [mlir][Transforms][NFC] Dialect Conversion: Simplify
`finalize` signature
This commit simplifies the signature of `OperationConverter::finalize`. This function always returns "success", so the return value can be removed.
Note: Previously, this function used to return "failure" if a materialization failed to legalize. This is now optional and happening at a later point of time (see `config.buildMaterializations`).
---
mlir/lib/Transforms/Utils/DialectConversion.cpp | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index b5aab2416c3eb9..a5872cd3d30696 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -2340,7 +2340,7 @@ struct OperationConverter {
/// This method is called after the conversion process to legalize any
/// remaining artifacts and complete the conversion.
- LogicalResult finalize(ConversionPatternRewriter &rewriter);
+ void finalize(ConversionPatternRewriter &rewriter);
/// Dialect conversion configuration.
ConversionConfig config;
@@ -2464,8 +2464,7 @@ LogicalResult OperationConverter::convertOperations(ArrayRef<Operation *> ops) {
// Now that all of the operations have been converted, finalize the conversion
// process to ensure any lingering conversion artifacts are cleaned up and
// legalized.
- if (failed(finalize(rewriter)))
- return rewriterImpl.undoRewrites(), failure();
+ finalize(rewriter);
// After a successful conversion, apply rewrites if this is not an analysis
// conversion.
@@ -2542,8 +2541,7 @@ getReplacedValues(IRRewrite *rewrite) {
return {};
}
-LogicalResult
-OperationConverter::finalize(ConversionPatternRewriter &rewriter) {
+void OperationConverter::finalize(ConversionPatternRewriter &rewriter) {
ConversionPatternRewriterImpl &rewriterImpl = rewriter.getImpl();
DenseMap<Value, SmallVector<Value>> inverseMapping =
rewriterImpl.mapping.getInverse();
@@ -2578,8 +2576,6 @@ OperationConverter::finalize(ConversionPatternRewriter &rewriter) {
llvm::erase(inverseMapping[newValue], originalValue);
}
}
-
- return success();
}
//===----------------------------------------------------------------------===//
More information about the llvm-branch-commits
mailing list