ClangIR and the cost of MLIR
ClangIR (CIR) is an MLIR dialect between the AST and LLVM IR, and in October 2026 the clang area team accepted building it by default.
CIR is built on MLIR because each step along the way was locally reasonable, and together the steps locked MLIR in.
The costs (build time, binary size, MLIR API churn) land largely on Clang contributors who neither chose MLIR nor use CIR.
This post traces how CIR came to depend on MLIR, compares CIR with the IRs it cites as models, Rust's MIR and Swift's SIL, collects what the MLIR dependency costs, and uses an MLIR-free CIR as a thought experiment to separate the costs inherent to MLIR from those that can be reduced…
MaskRay