[Mlir-commits] [mlir] [MLIR] Make `OneShotModuleBufferize` use `OpInterface` (PR #107295)

Matthias Springer llvmlistbot at llvm.org
Fri Sep 6 09:08:50 PDT 2024


================
@@ -349,11 +354,15 @@ getFuncOpsOrderedByCalls(ModuleOp moduleOp,
 /// most generic layout map as function return types. After bufferizing the
 /// entire function body, a more concise memref type can potentially be used for
 /// the return type of the function.
-static void foldMemRefCasts(func::FuncOp funcOp) {
-  if (funcOp.getBody().empty())
+static void foldMemRefCasts(FunctionOpInterface funcOp) {
+  if (funcOp.getFunctionBody().empty())
+    return;
+
+  Operation *returnOp = getAssumedUniqueReturnOp(funcOp);
+
+  if (!returnOp || returnOp == funcOp)
----------------
matthias-springer wrote:

Why is this needed? Why would the return op be the same op as the function op?


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


More information about the Mlir-commits mailing list