[Mlir-commits] [mlir] [mlir] Use `OpBuilder::createBlock` in op builders and patterns (PR #82770)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Fri Feb 23 06:32:52 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));
----------------
ftynse wrote:

I suspect this may be also unhappy if the underlying implementation adds arguments to fusedBlock.

https://github.com/llvm/llvm-project/pull/82770


More information about the Mlir-commits mailing list