[Mlir-commits] [mlir] fa200dc - [mlir] Use PatternRewriter infrastructure for shape.assuming bufferization
Tres Popp
llvmlistbot at llvm.org
Fri Oct 9 07:01:15 PDT 2020
Author: Tres Popp
Date: 2020-10-09T16:01:02+02:00
New Revision: fa200dc3592e1947f55bf68f2cb2a796ee0bf7f0
URL: https://github.com/llvm/llvm-project/commit/fa200dc3592e1947f55bf68f2cb2a796ee0bf7f0
DIFF: https://github.com/llvm/llvm-project/commit/fa200dc3592e1947f55bf68f2cb2a796ee0bf7f0.diff
LOG: [mlir] Use PatternRewriter infrastructure for shape.assuming bufferization
Without this, legalization might not recursively handle child ops properly.
Additionally, this is required for pattern rewriting to properly rollback conversions.
Differential Revision: https://reviews.llvm.org/D89122
Added:
Modified:
mlir/lib/Dialect/Shape/Transforms/ShapeTypeConversion.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Shape/Transforms/ShapeTypeConversion.cpp b/mlir/lib/Dialect/Shape/Transforms/ShapeTypeConversion.cpp
index 2baa1175807c..6f4c96b87ca7 100644
--- a/mlir/lib/Dialect/Shape/Transforms/ShapeTypeConversion.cpp
+++ b/mlir/lib/Dialect/Shape/Transforms/ShapeTypeConversion.cpp
@@ -45,11 +45,9 @@ class TypeConversionAssumingOpConverter
auto newAssumingOp = rewriter.create<shape::AssumingOp>(
assumingOp.getLoc(), newResultTypes, assumingOp.witness());
- // Handle the region transfer carefully here to avoid assertions that both
- // operations are valid at replacement time.
- newAssumingOp.doRegion().push_back(new Block());
rewriter.replaceOp(assumingOp, newAssumingOp.getResults());
- newAssumingOp.doRegion().takeBody(assumingOp.doRegion());
+ rewriter.inlineRegionBefore(assumingOp.doRegion(), newAssumingOp.doRegion(),
+ newAssumingOp.doRegion().end());
return success();
}
More information about the Mlir-commits
mailing list