[Mlir-commits] [mlir] [mlir][memref] Add a new `ReifyResultShapes` pass (PR #145927)

Kunwar Grover llvmlistbot at llvm.org
Tue Jul 1 06:17:45 PDT 2025


================
@@ -209,6 +210,17 @@ memref::AllocaOp allocToAlloca(
     RewriterBase &rewriter, memref::AllocOp alloc,
     function_ref<bool(memref::AllocOp, memref::DeallocOp)> filter = nullptr);
 
+/// Reifies the results of `op`, potentially replacing `op` with a reified
+/// version. Returns `failure` if `mlir::reifyResultShapes` returned failure,
+/// otherwise it always succeeds. Users of this transform should always expect
+/// it to modify the IR, even when it fails. If any of the result types changes,
+/// the transform will insert cast operations to the old type to keep the IR
+/// consistent.
+///
+/// Note: This transform only works on ranked `memref` or `tensor` results,
+/// other types are ignored.
+LogicalResult reifyOpResultShapes(RewriterBase &rewriter,
+                                  ReifyRankedShapedTypeOpInterface op);
----------------
Groverkss wrote:

Do we want to expose it like this? We know this doesnt work for all ops and might just confused people. Can we keep it inside the pass for now or explicitly document what it can do and what it cannot?

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


More information about the Mlir-commits mailing list