[Mlir-commits] [mlir] Fix llvm-mlir-use-after-erase findings (PR #210733)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Jul 27 23:46:18 PDT 2026


================
@@ -301,14 +301,15 @@ void NormalizeMemRefs::updateFunctionSignature(func::FuncOp funcOp,
         // If it failed (due to escapes for example), bail out.
         // It should never hit this part of the code because it is called by
         // only those functions which are normalizable.
-        newCallOp->erase();
         replacingMemRefUsesFailed = true;
         break;
       }
       returnTypeChanged = true;
     }
-    if (replacingMemRefUsesFailed)
+    if (replacingMemRefUsesFailed) {
+      newCallOp->erase();
       continue;
+    }
----------------
Harald-R wrote:

I have reverted this change.

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


More information about the Mlir-commits mailing list