[Mlir-commits] [mlir] [mlir] Method to iterate over registered operations for a given dialect class. (PR #112344)

Mehdi Amini llvmlistbot at llvm.org
Wed Oct 16 12:03:54 PDT 2024


================
@@ -976,12 +994,19 @@ void RegisteredOperationName::insert(
          "operation name registration must be successful");
 
   // Add emplaced operation name to the sorted operations container.
+  StringRef dialectClass = impl->getDialect()->getNamespace();
+  ctxImpl.getCountByDialectName[dialectClass] += 1;
+
   RegisteredOperationName &value = emplaced.first->second;
   ctxImpl.sortedRegisteredOperations.insert(
       llvm::upper_bound(ctxImpl.sortedRegisteredOperations, value,
                         [](auto &lhs, auto &rhs) {
-                          return lhs.getIdentifier().compare(
-                              rhs.getIdentifier());
+                          if (lhs.getDialect().getNamespace() ==
+                              rhs.getDialect().getNamespace())
+                            return lhs.getIdentifier().compare(
+                                rhs.getIdentifier());
+                          return lhs.getDialect().getNamespace().compare(
+                              rhs.getDialect().getNamespace());
----------------
joker-eph wrote:

I'm confused: what are you trying to achieve here? Why isn't the existing code good enough?

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


More information about the Mlir-commits mailing list