[Mlir-commits] [mlir] [MLIR][Python] Make location optional in Python-defined dialect loading (PR #186172)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Mar 12 19:10:54 PDT 2026


================
@@ -804,9 +805,10 @@ def _emit_dialect(cls) -> None:
 
     @classmethod
     def _emit_module(cls) -> ir.Module:
-        m = ir.Module.create()
-        with ir.InsertionPoint(m.body):
-            cls._emit_dialect()
+        with ir.Location.unknown() if not ir.Location.current else nullcontext():
----------------
PragmaTwice wrote:

Yah I think `with Location.current` will push the location again to the internal stack? It seems unnecessary so I use `nullcontext`.

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


More information about the Mlir-commits mailing list