3 min read

Julia gets UnifiedIR in sweeping compiler draft

A draft Julia pull request adds UnifiedIR, a single IR designed to span parsing, lowering, inference, and optimization with zero dependencies.

Image: Hacker News

A draft pull request to Julia introduces UnifiedIR, a single intermediate representation intended to span the compiler pipeline and external compilers. The work, posted by Keno on July 11, 2026, describes one shared IR data structure for syntax, lowering, inference, and optimization, with zero dependencies and early integration into Base.

At the core is a flat statement table with hybrid regions over a shared storage layer called AttrGraph, plus a verifier, printer/parser, reference interpreter, and GC-like compaction via compact_graph! and collect_syntax!. The proposal wires UnifiedIR into Julia’s top-level packages, bootstraps it into Base immediately before JuliaSyntax, and rebuilds sysbase when its sources change. In that setup, JuliaSyntax’s SyntaxGraph runs on UnifiedIR.

The draft also consolidates several existing concepts into one substrate:

  • One storage core: SyntaxGraph wraps UnifiedIR.AttrGraph
  • One porcelain: SyntaxTree{Attrs} becomes UnifiedIR.Tree{SyntaxGraph{Attrs}}
  • One kind registry: dialects claim contiguous opcode blocks in a shared registry

Reserved dialect IDs are fixed for the bootstrap stack: core=0, JuliaSyntax=1, JuliaLowering=2, and formatter=3. The numbering is described as deterministic so baked constants remain valid.

Unified compiler path and optimization work

The pull request adds JuliaLowering.UnifiedBackend as an additive backend that keeps the front half of lowering unchanged — including macro expansion, desugaring, scope analysis, and closure conversion — but emits structured UnifiedIR region forms instead of goto-based linear IR. Each emitted statement carries a :source entry pointing back to the originating syntax cursor, allowing diagnostics to trace optimized IR back to exact source text.

Recommended reading

Russia’s cloud GPU demand jumps 507% on AI workloads

On the provider side, in package mode only, the draft includes:

  • CodeInfo ↔ UnifiedIR boundary converters
  • An inference port running natively on UnifiedIR
  • Optimizer passes including SROA, inlining via splice_body!, ADCE, structurization, and cell promotion
  • A Queries API
  • Activation through Julia’s compiler-replacement mechanism

According to the PR, the inference port was differentially validated at 100% equal-or-better return types against the stock pipeline on session MethodInstances.

The testing and demo setup is unusually extensive for a draft. The PR wires UnifiedIR/test into Julia’s test harness, adds UnifiedIR/demo/provenance_demo.jl, and includes Compiler/test/unified/. It also adds a NEWS.md entry under compiler/runtime improvements.

Later commits in the same draft improve tooling around the new IR. typed_ir now displays the full print_ir listing by default under text/plain, with truncation made opt-in through display_maxlines!(n) or IOContext(io, :ir_maxlines => n). A new @code_unified macro mirrors @code_typed, and Core.Const lattice types now render as Const(value).

The draft also renames the region-value terminator from yield to result, explicitly to avoid conflicting with Julia’s existing task-suspension meaning for Base.yield, with no semantic change.

Much of the later work focuses on cell-promotion and SSA construction. One commit says the optimizer wall time over the corpus drops by about 18%, and that typed_ir(gcd, (Int,Int)) retains zero cell ops after promotion. Another says stock-oracle violations across the Base/stdlib corpus fall from 38 bodies to 16, while corpus cell-op elimination rises from 20% to 55%. The PR also describes a structured fuzzer, CellFuzz, which ran 10k cases clean, plus a completeness benchmark over a 600-body corpus and 10k fuzz cases.

The pull request remains marked Draft.

Marcus Vance

Enterprise Editor

Marcus follows the money. He covers enterprise software, cloud architecture, and the tectonic shifts in Big Tech strategy. He translates dense earnings calls and complex M&A activity into actionable insights about where the industry is actually heading. If a tech giant makes a silent pivot, Marcus is usually the first to notice.

via Hacker News

// Keep reading