[Mlir-commits] [mlir] [mlir] Accept OpaqueAttr as a valid memory space if the context allows unregistered dialects (PR #187682)

Jacques Pienaar llvmlistbot at llvm.org
Sat Apr 11 23:29:25 PDT 2026


================
@@ -616,6 +616,12 @@ bool mlir::detail::isSupportedMemorySpace(Attribute memorySpace) {
   if (llvm::isa<IntegerAttr, StringAttr, DictionaryAttr>(memorySpace))
     return true;
 
+  // Allow opaque attributes if unregistered dialects are allowed.
+  // They hold unregistered custom dialect attributes.
+  if (memorySpace.getContext()->allowsUnregisteredDialects() &&
+      isa<OpaqueAttr>(memorySpace))
+    return true;
+
   // Allow custom dialect attributes.
   if (!isa<BuiltinDialect>(memorySpace.getDialect()))
----------------
jpienaar wrote:

Lets remove these checks yes. (if DictionaryAttr is allowed, then a dictionary of a Unit, Type and OpaqueAttr would go through and don't see why them alone should be flagged here given the relaxation on requirement).

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


More information about the Mlir-commits mailing list