[Mlir-commits] [mlir] [mlir][bufferization] Enable moving dependent values in eliminate-empty-tensors (PR #169718)

Mehdi Amini llvmlistbot at llvm.org
Fri Dec 5 01:51:02 PST 2025


================
@@ -105,8 +106,15 @@ Value mlir::bufferization::buildSubsetExtraction(RewriterBase &rewriter,
   // this replacement.
   Operation *insertionPoint =
       findValidInsertionPoint(emptyTensorOp, user, neededValues);
-  if (!insertionPoint)
-    return {};
+  if (!insertionPoint) {
+    // If no already suitable insertion point was found, attempt to move all
+    // needed values before the user.
+    if (failed(moveValueDefinitions(rewriter, neededValues, user,
+                                    /*ignoreSideEffects=*/false))) {
+      return {};
+    }
----------------
joker-eph wrote:

```suggestion
                                    /*ignoreSideEffects=*/false)))
      return {};
```

Nit: no extra braces

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


More information about the Mlir-commits mailing list