diff --git a/mlir/lib/Interfaces/DataLayoutInterfaces.cpp b/mlir/lib/Interfaces/DataLayoutInterfaces.cpp --- a/mlir/lib/Interfaces/DataLayoutInterfaces.cpp +++ b/mlir/lib/Interfaces/DataLayoutInterfaces.cpp @@ -440,6 +440,11 @@ const auto *iface = dialect->getRegisteredInterface(); + if (!iface) { + return emitError(loc) + << "the '" << dialect->getNamespace() + << "' dialect does not support identifier data layout entries"; + } if (failed(iface->verifyEntry(kvp.second, loc))) return failure(); } diff --git a/mlir/test/Interfaces/DataLayoutInterfaces/types.mlir b/mlir/test/Interfaces/DataLayoutInterfaces/types.mlir --- a/mlir/test/Interfaces/DataLayoutInterfaces/types.mlir +++ b/mlir/test/Interfaces/DataLayoutInterfaces/types.mlir @@ -7,6 +7,13 @@ // ----- +// expected-error@below {{the 'test' dialect does not support identifier data layout entries}} +"test.op_with_data_layout"() { dlti.dl_spec = #dlti.dl_spec< + #dlti.dl_entry, + #dlti.dl_entry<"test.foo", [32]>>} : () -> () + +// ----- + // CHECK-LABEL: @index module @index attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry>} {