1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! IR cleanup catalog.
//!
//! Cost-monotone-down structural simplifications: deterministic BufferDecl
//! order, empty Block collapse, Region body inline, singleton Region block
//! promotion, constant-condition If branch elimination, and self-assignment
//! Assign elimination.
/// Coalesce nested `If` whose outer body is exactly one inner `If` with
/// no else-arm into a single `If` whose condition is the conjunction
/// of the two (ROADMAP A23).
/// Hoist a common observably-free `Let` prefix out of a divergent
/// `Node::If` (ROADMAP A18 — cross-branch GVN entry point).
/// Sort `Program::buffers()` by `(binding, name)` for deterministic IR and
/// content-addressable cache stability.
/// Drop `Node::Block(vec![])` markers from sibling sequences.
/// Replace `Node::If` whose condition is `LitBool(true|false)` with the
/// surviving arm wrapped in a `Node::Block`.
/// Drop `Node::Assign { name, value: Var(name) }` self-assignments.
/// Fuse adjacent compatible `Node::Region` pairs per the built-in
/// fusion table (ROADMAP H5 — GEMM+activation foundation half).
/// Region-inline pass.
/// Region-inline transform engine — pure IR-to-IR fn body used by the
/// `RegionInlinePass` ProgramPass. Held as a sibling so callers can reuse
/// the raw transform without constructing a scheduler entry.
/// Promote `Region { body: [Block(inner)] }` to `Region { body: inner }`.
/// Drop `Let(name, cheap_leaf)` and inline `cheap_leaf` at every use
/// site when `name` is never reassigned (ROADMAP A14 — register-
/// pressure rematerialization).
/// Hoist common side-effect-free branch tails after a divergent `If`.