[Mlir-commits] [mlir] [mlir] Add a utility method to move operation dependencies. (PR #129975)

Jakub Kuderski llvmlistbot at llvm.org
Wed Mar 5 19:34:39 PST 2025


================
@@ -1054,3 +1057,65 @@ LogicalResult mlir::simplifyRegions(RewriterBase &rewriter,
   return success(eliminatedBlocks || eliminatedOpsOrArgs ||
                  mergedIdenticalBlocks || droppedRedundantArguments);
 }
+
+//===---------------------------------------------------------------------===//
+// Move operation dependencies
+//===---------------------------------------------------------------------===//
+
+LogicalResult mlir::moveOperationDependencies(RewriterBase &rewriter,
+                                              Operation *op,
+                                              Operation *insertionPoint,
+                                              DominanceInfo &dominance) {
+  // Currently unsupported case where the op and insertion point are
+  // in different basic blocks.
+  if (op->getBlock() != insertionPoint->getBlock()) {
+    return rewriter.notifyMatchFailure(
+        op, "unsupported caes where operation and insertion point are not in "
+            "the sme basic block");
----------------
kuhar wrote:

```suggestion
            "the same basic block");
```

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


More information about the Mlir-commits mailing list