[Mlir-commits] [mlir] [MLIR][Python] Make location optional in Python-defined dialect loading (PR #186172)
Rolf Morel
llvmlistbot at llvm.org
Thu Mar 12 18:40:30 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():
----------------
rolfmorel wrote:
When `ir.Location.current` is _something_ that should mean we are already executing inside its/that context manager. No need to enter its context manager/another context manager for it again. If this isn't (always) the case, do let us know.
https://github.com/llvm/llvm-project/pull/186172
More information about the Mlir-commits
mailing list