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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Sep 10 09:02:58 PDT 2024


================
@@ -349,11 +348,11 @@ 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() || funcOp.getNumResults() == 0)
----------------
erick-xanadu wrote:

I think if this breaks some tests (like in the case of the `transform::NamedSequenceOp` being bufferized) then the tests should be changed.

```suggestion
  if (funcOp.getFunctionBody().empty())
```

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


More information about the Mlir-commits mailing list