MLIR for People Who Only Know LLVM IR: A Guided Tour

MLIR for People Who Only Know LLVM IR: A Guided Tour A practical mental-model bridge from LLVM IR to MLIR for people who already think in terms of functions, basic blocks, and passes. November 25, 2025 · 10 min Table of Contents TL;DR: The Mental Mapping Modules, functions, blocks, and values LLVM IR Mental Model MLIR Mental Model Example: hello, function Dialects: Instruction Sets for Different Domains Dialects as namespaces Operations, Regions, and Nested Control Flow Regions in pratctice Nested IR everywhere Types and Attributes SSA value types Attributes A side-by-side example LLVM IR MLIR Breakdown Passes and pipelines Pattern rewrites: opt passes with a twist How does this become LLVM IR? How to start reading MLIR as an LLVM person Why MLIR? If you already speak LLVM IR, MLIR can feel like a cousin who redesigned the house while you were out: ...

February 22, 2026 · 10 min

How Rewriting works in MLIR

An in-depth look at the rewriting mechanisms in MLIR and how they enable powerful optimizations. Table of Contents TL;DR Part 1: The moving pieces RewritePatternSet and PatternRewriter Greedy vs. Conversion Greedy (Canonicalization and Local Rewrites) Conversion (Dialect Conversion) Part 2: Your first greedy rewrite pattern. Pattern Definition Part 3 : Running it: Tiny IR + Command Build and run Result Part 4: Dialect Conversion in a nutshell Core ingredients Example: Convert toy.addi to arith.addi Key differences from greedy patterns: Part 5 : Folding vs. Patterns Part 6: Match helpers, benefits, and ordering Part 7: Debugging and guardrails Part 8: Mini LIT Test Example Conclusion Further Reading If you only remember one thing from this post: rewriting in MLIR is “find a pattern, make a change, repeat until more changes can’t be made”, with two key components: ...

November 8, 2025 · 6 min