[Mlir-commits] [mlir] [mlir] notify insertion of parent op first when cloning (PR #73806)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Nov 30 00:56:30 PST 2023


================
@@ -527,6 +527,7 @@ LogicalResult OpBuilder::tryFold(Operation *op,
 
 Operation *OpBuilder::clone(Operation &op, IRMapping &mapper) {
   Operation *newOp = op.clone(mapper);
+  newOp = insert(newOp);
----------------
jeanPerier wrote:

No, the conversion is not attempted right when being notified about the insertion. When cloning inside a pattern, the legalization for the cloned operation is only done when the replacement/root update is finalized. The legalization is done in the same order the notification were emitted.
This is just like when creating an operation with a region inside a pattern directly (without cloning).

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


More information about the Mlir-commits mailing list