diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp --- a/mlir/lib/IR/MLIRContext.cpp +++ b/mlir/lib/IR/MLIRContext.cpp @@ -175,11 +175,6 @@ /// destruction with the context. std::unique_ptr ownedThreadPool; - /// This is a list of dialects that are created referring to this context. - /// The MLIRContext owns the objects. - DenseMap> loadedDialects; - DialectRegistry dialectsRegistry; - /// An allocator used for AbstractAttribute and AbstractType objects. llvm::BumpPtrAllocator abstractDialectSymbolAllocator; @@ -193,6 +188,12 @@ /// and efficient `getRegisteredOperations` implementation. SmallVector sortedRegisteredOperations; + /// This is a list of dialects that are created referring to this context. + /// The MLIRContext owns the objects. These need to be declared after the + /// registered operations to ensure correct destruction order. + DenseMap> loadedDialects; + DialectRegistry dialectsRegistry; + /// A mutex used when accessing operation information. llvm::sys::SmartRWMutex operationInfoMutex;