[Mlir-commits] [mlir] [MLIR][Standalone] use narrow registration instead of RegisterEverything (PR #160469)

Maksim Levental llvmlistbot at llvm.org
Wed Sep 24 08:06:04 PDT 2025


================
@@ -12,21 +12,14 @@
 #include <stdio.h>
 
 #include "Standalone-c/Dialects.h"
+#include "mlir-c/Dialect/Arith.h"
+#include "mlir-c/Dialect/Builtin.h"
 #include "mlir-c/IR.h"
-#include "mlir-c/RegisterEverything.h"
-
-static void registerAllUpstreamDialects(MlirContext ctx) {
-  MlirDialectRegistry registry = mlirDialectRegistryCreate();
-  mlirRegisterAllDialects(registry);
-  mlirContextAppendDialectRegistry(ctx, registry);
-  mlirDialectRegistryDestroy(registry);
-}
 
 int main(int argc, char **argv) {
   MlirContext ctx = mlirContextCreate();
-  // TODO: Create the dialect handles for the builtin dialects and avoid this.
-  // This adds dozens of MB of binary size over just the standalone dialect.
-  registerAllUpstreamDialects(ctx);
+  mlirDialectHandleRegisterDialect(mlirGetDialectHandle__arith__(), ctx);
+  mlirDialectHandleRegisterDialect(mlirGetDialectHandle__builtin__(), ctx);
----------------
makslevental wrote:

Err you're right - I got confused by the comment right here. Anyway, removed the builtin handles changes.

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


More information about the Mlir-commits mailing list