[Mlir-commits] [mlir] [mlir] Avoid removing returns for mismatch call results (PR #207587)
Darwin Morris
llvmlistbot at llvm.org
Sun Jul 5 08:55:38 PDT 2026
================
@@ -335,14 +335,26 @@ static void processFuncOp(FunctionOpInterface funcOp, Operation *module,
// can make our optimization strong by even removing a live return value (%0),
// since it forwards only to non-live value(s) (%1#1).
size_t numReturns = funcOp.getNumResults();
+ bool canCleanReturnValues = true;
BitVector nonLiveRets(numReturns, true);
+
for (SymbolTable::SymbolUse use : uses) {
Operation *callOp = use.getUser();
assert(isa<CallOpInterface>(callOp) && "expected a call-like user");
+
+ if (callOp->getNumResults() != numReturns) {
----------------
darwinmorris wrote:
Good point. I looked through `CallOpInterface` and didn’t find anything that guarantees a 1:1 correspondence between callee results and operation results. I’ll look into adding an explicit interface method for result correspondence (with a conservative default), and then use that in `RemoveDeadValues`, if that seems like the right direction.
https://github.com/llvm/llvm-project/pull/207587
More information about the Mlir-commits
mailing list