[Mlir-commits] [mlir] 69b9e03 - [mlir] Do not expose MLIRContext::isDialectLoading
Matthias Springer
llvmlistbot at llvm.org
Mon Oct 31 01:08:52 PDT 2022
Author: Matthias Springer
Date: 2022-10-31T09:08:44+01:00
New Revision: 69b9e03572d7888007dca42ee6af5325779cfcc2
URL: https://github.com/llvm/llvm-project/commit/69b9e03572d7888007dca42ee6af5325779cfcc2
DIFF: https://github.com/llvm/llvm-project/commit/69b9e03572d7888007dca42ee6af5325779cfcc2.diff
LOG: [mlir] Do not expose MLIRContext::isDialectLoading
This addresses post-commit comments and should have been part of D136685.
Differential Revision: https://reviews.llvm.org/D136923
Added:
Modified:
mlir/include/mlir/IR/MLIRContext.h
mlir/lib/IR/MLIRContext.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/MLIRContext.h b/mlir/include/mlir/IR/MLIRContext.h
index b87dd27b2aaa9..7537f0c365723 100644
--- a/mlir/include/mlir/IR/MLIRContext.h
+++ b/mlir/include/mlir/IR/MLIRContext.h
@@ -98,9 +98,6 @@ class MLIRContext {
}));
}
- /// Return true if the given dialect is currently loading.
- bool isDialectLoading(StringRef dialectNamespace);
-
/// Load a dialect in the context.
template <typename Dialect>
void loadDialect() {
@@ -239,6 +236,9 @@ class MLIRContext {
llvm::hash_code getRegistryHash();
private:
+ /// Return true if the given dialect is currently loading.
+ bool isDialectLoading(StringRef dialectNamespace);
+
const std::unique_ptr<MLIRContextImpl> impl;
MLIRContext(const MLIRContext &) = delete;
diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp
index 896938d4406f7..58097940a0397 100644
--- a/mlir/lib/IR/MLIRContext.cpp
+++ b/mlir/lib/IR/MLIRContext.cpp
@@ -430,10 +430,10 @@ MLIRContext::getOrLoadDialect(StringRef dialectNamespace, TypeID dialectID,
"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> &dialect = impl.loadedDialects[dialectNamespace] =
- ctor();
+ // loadedDialects entry is initialized to nullptr, indicating that the
+ // dialect is currently being loaded.
+ std::unique_ptr<Dialect> &dialect = impl.loadedDialects[dialectNamespace];
+ dialect = ctor();
assert(dialect && "dialect ctor failed");
// Refresh all the identifiers dialect field, this catches cases where a
More information about the Mlir-commits
mailing list