[Mlir-commits] [flang] [mlir] [mlir] Support DialectRegistry extension comparison (PR #101119)

River Riddle llvmlistbot at llvm.org
Thu Aug 1 10:17:39 PDT 2024


================
@@ -287,13 +288,23 @@ void DialectRegistry::applyExtensions(MLIRContext *ctx) const {
 
   // Note: Additional extensions may be added while applying an extension.
   for (int i = 0; i < static_cast<int>(extensions.size()); ++i)
-    applyExtension(*extensions[i]);
+    applyExtension(*extensions[i].second);
 }
 
 bool DialectRegistry::isSubsetOf(const DialectRegistry &rhs) const {
-  // Treat any extensions conservatively.
-  if (!extensions.empty())
+  // Check that all extension keys are present in 'rhs'.
+  llvm::DenseSet<TypeID> rhsExtensionKeys;
+  {
+    auto rhsKeys = llvm::map_range(rhs.extensions,
+                                   [](const auto &item) { return item.first; });
----------------
River707 wrote:

llvm::make_first_range

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


More information about the Mlir-commits mailing list