[Mlir-commits] [mlir] [MLIR] Make `OneShotModuleBufferize` use `OpInterface` (PR #107295)
Tzung-Han Juang
llvmlistbot at llvm.org
Fri Sep 6 14:48:02 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)
----------------
tzunghanjuang wrote:
This is to prevent `NamedSequenceOp` from being analyzed because it has no return. We have updated `getAssumedUniqueReturnOp` so the guard is moved to the start of `aliasingFuncOpBBArgsAnalysis` (by checking the number of return types).
https://github.com/llvm/llvm-project/pull/107295
More information about the Mlir-commits
mailing list