[Mlir-commits] [mlir] Fix llvm-mlir-use-after-erase findings (PR #210733)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Jul 27 23:18:17 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:
Yes, this is the false positive mentioned in the PR description. I changed it to make the lifetime of `newCallOp` more easily visible and avoid possible issues like the other instance from this file (line 460), where the iteration can continue after the operation was erased. This is indeed not a necessary change, and I can revert it if desired.
https://github.com/llvm/llvm-project/pull/210733
More information about the Mlir-commits
mailing list