[Mlir-commits] [mlir] [MLIR][Python] remove `liveOperations` (PR #155114)

Jacques Pienaar llvmlistbot at llvm.org
Tue Aug 26 07:15:37 PDT 2025


================
@@ -1252,35 +1158,16 @@ PyOperationRef PyOperation::createInstance(PyMlirContextRef contextRef,
 PyOperationRef PyOperation::forOperation(PyMlirContextRef contextRef,
                                          MlirOperation operation,
                                          nb::object parentKeepAlive) {
-  nb::ft_lock_guard lock(contextRef->liveOperationsMutex);
-  auto &liveOperations = contextRef->liveOperations;
-  auto it = liveOperations.find(operation.ptr);
-  if (it == liveOperations.end()) {
-    // Create.
-    PyOperationRef result = createInstance(std::move(contextRef), operation,
-                                           std::move(parentKeepAlive));
-    liveOperations[operation.ptr] =
-        std::make_pair(result.getObject(), result.get());
-    return result;
-  }
-  // Use existing.
-  PyOperation *existing = it->second.second;
-  nb::object pyRef = nb::borrow<nb::object>(it->second.first);
-  return PyOperationRef(existing, std::move(pyRef));
+  // Create.
----------------
jpienaar wrote:

I'd drop this, the function name seems clear enough for me.

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


More information about the Mlir-commits mailing list