Skip to content

[mlir][Transforms][NFC] Dialect Conversion: Simplify finalize signature #110419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions mlir/lib/Transforms/Utils/DialectConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -2578,8 +2576,6 @@ OperationConverter::finalize(ConversionPatternRewriter &rewriter) {
llvm::erase(inverseMapping[newValue], originalValue);
}
}

return success();
}

//===----------------------------------------------------------------------===//
Expand Down
Loading