[Mlir-commits] [mlir] [mlir][bufferization] Return early in aliasing analysis (PR #173529)
Matthias Springer
llvmlistbot at llvm.org
Thu Dec 25 02:53:47 PST 2025
================
@@ -136,7 +136,10 @@ aliasingFuncOpBBArgsAnalysis(FuncOp funcOp, OneShotAnalysisState &state,
// Find all func.return ops.
SmallVector<func::ReturnOp> returnOps = getReturnOps(funcOp);
- assert(!returnOps.empty() && "expected at least one ReturnOp");
+ // Gracefully exit if no func.return ops are found.
+ if (returnOps.empty()) {
+ return success();
----------------
matthias-springer wrote:
This should be `return failure();` along with an error message: `funcOp.emitError("cannot bufferize func.func without func.return")`.
`return success()` is dangerous because we skipped an analysis.
https://github.com/llvm/llvm-project/pull/173529
More information about the Mlir-commits
mailing list