The acyclic e-graph: Cranelift's mid-end optimizer

April 10, 2026
A high-rise building under construction with visible scaffolding and cranes.
Photo by Mike van Schoonderwalt on Pexels

Cranelift's mid-end has a new beating heart: the "aegraph," an acyclic e-graph designed to make aggressive, interdependent optimizations practical in a production JIT. The approach was introduced by its author in 2022 and, after what he describes as a somewhat circuitous path — including a full rewrite, patches to the original idea, and lots of community feedback — the aegraph is now the centerpiece of Cranelift's mid-end. It has been reported that early experiments showed measurable wins (about a 5% speedup on meshoptimizer), though the author is careful to frame results and tradeoffs as ongoing work.

What the aegraph actually is

Think e-graphs, but tamed. Instead of going full-bore on equality saturation (which can explode and hang compilers), Cranelift uses an acyclic, sea-of-nodes-first design: build a compact, non-cyclic IR representation, fuse translation passes into and out of that representation, and only then introduce equivalence-class machinery where it pays off. The blog post walks readers through the why, the how, and the how-much — and reframes the aegraph pedagogy so sea-of-nodes comes first, unions later. The result: many of the reasoning chains that used to bounce between separate passes (GVN, LICM, redundant-load elimination, etc.) can be handled in a single, unified flow.

Why this matters

Compilers fight the pass-ordering problem all the time. Do you run RLE first, then GVN, then RLE again? That back-and-forth is tedious and brittle. The aegraph aims to short-circuit those chains by keeping the core IR expressive enough to capture the relationships between transformations, while avoiding the worst-case costs of unrestricted equality saturation. It isn't magic — there was a full rewrite and a lot of rule-writing — but the community attention (talks at the EGRAPHS workshop at PLDI 2023 and discussions at Dagstuhl) suggests this is more than a one-off hack.

The post is part technical design sketch, part post-mortem, and part invitation: can this middle ground between coarse-grained passes and full saturation scale for real-world JITs? The author lays out metrics and comparisons to assess the tradeoffs, and the tone is clear — cautious optimism. Compiler folks will want to read it; others can enjoy the drama of a pragmatic engineering story: bold idea, messy reality, rewrite, and finally something useful.

Sources: cfallin.org, Lobsters