[Mlir-commits] [mlir] [mlir] Use `OpBuilder::createBlock` in op builders and patterns (PR #82770)
Matthias Springer
llvmlistbot at llvm.org
Fri Feb 23 06:51:31 PST 2024
================
@@ -299,8 +299,7 @@ struct FuseSparseMultiplyOverAdd : public OpRewritePattern<GenericOp> {
Block &prodBlock = prod.getRegion().front();
Block &consBlock = op.getRegion().front();
IRMapping mapper;
- Block *fusedBlock = new Block();
- fusedOp.getRegion().push_back(fusedBlock);
+ Block *fusedBlock = rewriter.createBlock(&fusedOp.getRegion());
unsigned num = prodBlock.getNumArguments();
for (unsigned i = 0; i < num - 1; i++)
addArg(mapper, fusedBlock, prodBlock.getArgument(i));
----------------
matthias-springer wrote:
We have no `notifyBlockModified` callback at the moment, so I think there is no expectation that a listener be notified about adding/removing/changing block arguments. I have plans to add `RewriterBase::Listener::notifyBlockModified` and generalize `modifyOpInPlace` to `modifyInPlace` (accepting both ops and blocks).
https://github.com/llvm/llvm-project/pull/82770
More information about the Mlir-commits
mailing list