[Mlir-commits] [mlir] [mlir] fix copying DialectRegistry and OperationState (PR #140963)

Maksim Levental llvmlistbot at llvm.org
Wed May 21 15:10:34 PDT 2025


https://github.com/makslevental updated https://github.com/llvm/llvm-project/pull/140963

>From 3953c736333af51d98cb467a7c58aa03556da4d1 Mon Sep 17 00:00:00 2001
From: Maksim Levental <maksim.levental at gmail.com>
Date: Wed, 21 May 2025 17:42:32 -0400
Subject: [PATCH] [mlir] fix copying DialectRegistry and OperationState

---
 mlir/include/mlir/IR/DialectRegistry.h  | 2 ++
 mlir/include/mlir/IR/OperationSupport.h | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/mlir/include/mlir/IR/DialectRegistry.h b/mlir/include/mlir/IR/DialectRegistry.h
index d3d53488fe72d..7bcf1eda7c636 100644
--- a/mlir/include/mlir/IR/DialectRegistry.h
+++ b/mlir/include/mlir/IR/DialectRegistry.h
@@ -143,6 +143,8 @@ class DialectRegistry {
 
 public:
   explicit DialectRegistry();
+  DialectRegistry(const DialectRegistry &) = delete;
+  DialectRegistry &operator=(const DialectRegistry &other) = delete;
 
   template <typename ConcreteDialect>
   void insert() {
diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index 2d9fb2bc5859e..0046d977c68f4 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -985,9 +985,9 @@ struct OperationState {
                  BlockRange successors = {},
                  MutableArrayRef<std::unique_ptr<Region>> regions = {});
   OperationState(OperationState &&other) = default;
-  OperationState(const OperationState &other) = default;
   OperationState &operator=(OperationState &&other) = default;
-  OperationState &operator=(const OperationState &other) = default;
+  OperationState(const OperationState &other) = delete;
+  OperationState &operator=(const OperationState &other) = delete;
   ~OperationState();
 
   /// Get (or create) a properties of the provided type to be set on the



More information about the Mlir-commits mailing list