[Mlir-commits] [mlir] [mlir][bufferization]-Replace only one use in TensorEmptyElimination (PR #118958)

Matthias Springer llvmlistbot at llvm.org
Tue Dec 17 11:53:19 PST 2024


================
@@ -159,8 +162,9 @@ LogicalResult mlir::bufferization::eliminateEmptyTensors(
         replacement = rewriter.create<tensor::CastOp>(v.getLoc(), v.getType(),
                                                       replacement);
       }
-      // Replace the tensor::EmptyOp.
-      rewriter.replaceOp(emptyTensorOp, replacement);
+      // Replace the specific use of the tensor::EmptyOp.
+      useToBeReplaced->getOwner()->setOperand(
----------------
matthias-springer wrote:

wrap this in `rewriter.modifyOpInPlace`

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


More information about the Mlir-commits mailing list