[Mlir-commits] [mlir] Allowing RDV to call `getArgOperandsMutable()` (PR #160415)
Mehdi Amini
llvmlistbot at llvm.org
Wed Sep 24 06:46:42 PDT 2025
================
@@ -754,17 +756,51 @@ static void cleanUpDeadVals(RDVFinalCleanupList &list) {
// Some functions may not allow erasing arguments or results. These calls
// return failure in such cases without modifying the function, so it's okay
// to proceed.
- (void)f.funcOp.eraseArguments(f.nonLiveArgs);
+ if (succeeded(f.funcOp.eraseArguments(f.nonLiveArgs))) {
+ // Record only if we actually erased something.
+ if (f.nonLiveArgs.any())
+ erasedFuncArgs.try_emplace(f.funcOp.getOperation(), f.nonLiveArgs);
+ }
(void)f.funcOp.eraseResults(f.nonLiveRets);
}
// 4. Operands
LDBG() << "Cleaning up " << list.operands.size() << " operand lists";
for (OperationToCleanup &o : list.operands) {
- if (o.op->getNumOperands() > 0) {
- LDBG() << "Erasing " << o.nonLive.count()
- << " non-live operands from operation: "
- << OpWithFlags(o.op, OpPrintingFlags().skipRegions());
+ if (auto call = dyn_cast<CallOpInterface>(o.op)) {
+ if (SymbolRefAttr sym = call.getCallableForCallee().dyn_cast<SymbolRefAttr>()) {
+ Operation *callee = SymbolTable::lookupNearestSymbolFrom(o.op, sym);
----------------
joker-eph wrote:
Actually at the time the call operation is added, we got it from the funcOp, so we have a matching that could be added somehow at the same time to the `OperationToCleanup`.
https://github.com/llvm/llvm-project/pull/160415
More information about the Mlir-commits
mailing list