[Mlir-commits] [mlir] [mlir] [bufferize] fix crash when bufferize function without func.return returning op (PR #120675)

donald chen llvmlistbot at llvm.org
Tue Dec 24 04:14:49 PST 2024


================
@@ -434,11 +434,11 @@ static void foldMemRefCasts(func::FuncOp funcOp) {
     return;
 
   // Compute the common result types of all return ops.
-  SmallVector<func::ReturnOp> returnOps = getReturnOps(funcOp);
+  SmallVector<Operation *> returnOps = getReturnOps(funcOp);
   SmallVector<Type> resultTypes = getReturnTypes(returnOps);
 
   // Remove direct casts.
-  for (func::ReturnOp returnOp : returnOps) {
+  for (Operation *returnOp : returnOps) {
     for (OpOperand &operand : returnOp->getOpOperands()) {
----------------
cxy-1993 wrote:

Good point. For robust support of a generic return, a return interface is indeed necessary. However, the current return trait operations don't have extra operands, I think we can implement it like this temporarily.

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


More information about the Mlir-commits mailing list