[Mlir-commits] [mlir] Allowing RDV to call `getArgOperandsMutable()` (PR #160415)

Francisco Geiman Thiesen llvmlistbot at llvm.org
Wed Sep 24 20:00:12 PDT 2025


================
@@ -754,17 +760,50 @@ 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)) {
+      // Use the stored callee reference if available, avoiding expensive symbol
+      // lookup
+      if (o.callee) {
----------------
FranciscoThiesen wrote:

True, added an explicit check to only apply the call related logic if it is one.

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


More information about the Mlir-commits mailing list