[Mlir-commits] [mlir] [mlir] load dialect in parser for optional parameters (PR #96667)

Jeremy Kun llvmlistbot at llvm.org
Fri Jun 28 15:18:06 PDT 2024


================
@@ -424,9 +424,11 @@ void DefFormat::genVariableParser(ParameterElement *el, FmtContext &ctx,
         Dialect dialect(dialectInit->getDef());
         auto cppNamespace = dialect.getCppNamespace();
         std::string name = dialect.getCppClassName();
-        dialectLoading = ("\nodsParser.getContext()->getOrLoadDialect<" +
-                          cppNamespace + "::" + name + ">();")
-                             .str();
+        if (name != "BuiltinDialect" || cppNamespace != "::mlir") {
----------------
j2kun wrote:

Overall this condition is the logical negation of `name == "BuiltinDialect" && namespace == "::mlir"`. For some unholy reason, someone might make an out-of-tree dialect called `BuiltinDialect` in a different namespace. In that case, we would still want to load it.

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


More information about the Mlir-commits mailing list