[Mlir-commits] [mlir] [mlir] Avoid removing returns for mismatch call results (PR #207587)
Mehdi Amini
llvmlistbot at llvm.org
Sun Jul 5 07:02:45 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) {
----------------
joker-eph wrote:
This seems like an unsafe heuristic: if the call can consume some value, it can also inject some potentially: the fact that the number matches does not mean you have a 1:1 correspondance with the results. Seems like something that the `CallOpInterface` should provide.
https://github.com/llvm/llvm-project/pull/207587
More information about the Mlir-commits
mailing list