[Mlir-commits] [mlir] 6e8a8c2 - [mlir] Fix bug in use of rewiter for AtomicRMWOp.
Tres Popp
llvmlistbot at llvm.org
Mon Nov 9 07:00:41 PST 2020
Author: Tres Popp
Date: 2020-11-09T16:00:32+01:00
New Revision: 6e8a8c2d7e6c5091ee5c838e8cafafa72dbfca59
URL: https://github.com/llvm/llvm-project/commit/6e8a8c2d7e6c5091ee5c838e8cafafa72dbfca59
DIFF: https://github.com/llvm/llvm-project/commit/6e8a8c2d7e6c5091ee5c838e8cafafa72dbfca59.diff
LOG: [mlir] Fix bug in use of rewiter for AtomicRMWOp.
The legalization did not forward the listener which prevents dynamic
legalization and prevents rollbacks. This handled that and then changed
the associated pass to support all other std ops to support partial
conversion.
Previously, this lowering was failing, but due to the
initial bug, the op's modifications were not reverted, and thus the
pattern matching succeeded.
Differential Revision: https://reviews.llvm.org/D91079
Added:
Modified:
mlir/lib/Dialect/StandardOps/Transforms/ExpandAtomic.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/StandardOps/Transforms/ExpandAtomic.cpp b/mlir/lib/Dialect/StandardOps/Transforms/ExpandAtomic.cpp
index 8513880be2e1..2d04aec2c35e 100644
--- a/mlir/lib/Dialect/StandardOps/Transforms/ExpandAtomic.cpp
+++ b/mlir/lib/Dialect/StandardOps/Transforms/ExpandAtomic.cpp
@@ -57,7 +57,8 @@ struct AtomicRMWOpConverter : public OpRewritePattern<AtomicRMWOp> {
auto loc = op.getLoc();
auto genericOp =
rewriter.create<GenericAtomicRMWOp>(loc, op.memref(), op.indices());
- OpBuilder bodyBuilder = OpBuilder::atBlockEnd(genericOp.getBody());
+ OpBuilder bodyBuilder =
+ OpBuilder::atBlockEnd(genericOp.getBody(), rewriter.getListener());
Value lhs = genericOp.getCurrentValue();
Value rhs = op.value();
@@ -76,7 +77,7 @@ struct ExpandAtomic : public ExpandAtomicBase<ExpandAtomic> {
patterns.insert<AtomicRMWOpConverter>(&getContext());
ConversionTarget target(getContext());
- target.addLegalOp<GenericAtomicRMWOp>();
+ target.addLegalDialect<StandardOpsDialect>();
target.addDynamicallyLegalOp<AtomicRMWOp>([](AtomicRMWOp op) {
return op.kind() != AtomicRMWKind::maxf &&
op.kind() != AtomicRMWKind::minf;
More information about the Mlir-commits
mailing list