diff --git a/mlir/include/mlir/IR/MLIRContext.h b/mlir/include/mlir/IR/MLIRContext.h --- a/mlir/include/mlir/IR/MLIRContext.h +++ b/mlir/include/mlir/IR/MLIRContext.h @@ -98,9 +98,6 @@ })); } - /// Return true if the given dialect is currently loading. - bool isDialectLoading(StringRef dialectNamespace); - /// Load a dialect in the context. template void loadDialect() { @@ -239,6 +236,9 @@ llvm::hash_code getRegistryHash(); private: + /// Return true if the given dialect is currently loading. + bool isDialectLoading(StringRef dialectNamespace); + const std::unique_ptr impl; MLIRContext(const MLIRContext &) = delete; 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 @@ -430,10 +430,10 @@ "the PassManager): this can indicate a " "missing `dependentDialects` in a pass for example."); #endif // NDEBUG - // nullptr indicates that the dialect is currently being loaded. - impl.loadedDialects[dialectNamespace] = nullptr; - std::unique_ptr &dialect = impl.loadedDialects[dialectNamespace] = - ctor(); + // loadedDialects entry is initialized to nullptr, indicating that the + // dialect is currently being loaded. + std::unique_ptr &dialect = impl.loadedDialects[dialectNamespace]; + dialect = ctor(); assert(dialect && "dialect ctor failed"); // Refresh all the identifiers dialect field, this catches cases where a