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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Common-subexpression elimination — engine + ProgramPass registration colocated.
//!
//! Audit cleanup A6 (2026-04-30): hoisted from `transform/optimize/cse/`
//! so the engine lives next to its ProgramPass registration. The old
//! `transform/optimize/cse.rs` re-export shim is gone; downstream callers
//! use `crate::optimizer::passes::fusion_cse::cse::engine::cse(program)`
//! for the raw entry point or run the `CsePass` through the scheduler.
//!
//! ## Layout
//!
//! - `engine` — the `cse(program)` and `cse_into(program, &mut ctx)`
//! entry points; thin wrappers over `CseCtx::nodes`.
//! - `cse_ctx.rs` + `impl_csectx.rs` — the per-pass scratchpad context
//! (flat hashmap + scoped undo log + epoch invalidation; forks and
//! side-effect clears cost O(1) unless actual bindings change).
//! - `expr_key.rs` + `impl_exprkey.rs` — structural-equality key for
//! pure expressions; canonicalizes commutative operands.
//! - `expr_has_effect.rs` — conservative side-effect predicate (the
//! safety gate that prevents merging effectful nodes).
//! - `is_commutative.rs` — operator commutativity table.
//! - `type_key.rs` + `impl_typekey_from.rs` — compact `Copy` key for
//! expression result types.
//! - `program_pass.rs` — the registered `CsePass` (ProgramPass impl) that
//! hooks the engine into the scheduler's fixpoint loop.
/// Per-pass table of previously seen expression keys.
pub use CseCtx;
pub use ;
/// Classify whether an expression is unsafe to merge.
pub use expr_has_effect;
/// Return whether a binary operator can canonicalize operand order.
pub use is_commutative;
/// Compact key for expression result types.
pub use TypeKey;
/// Per-pass context tracking seen expressions and their first binding name.
/// Raw `cse(program)` and `cse_into(program, &mut ctx)` entry points.
/// Conservative predicate: does this expression have observable side effects?
/// Structural key for comparing candidate expressions during CSE.
/// Core CSE algorithm (`CseCtx::node` / `expr`).
/// Build an `ExprKey` from an [`Expr`](crate::ir::Expr).
/// `From<DataType>` implementation for `TypeKey`.
/// Which binary operators are commutative under CSE canonicalisation?
/// Registered `CsePass` (ProgramPass impl) for the engine.
/// Compact `Copy` key for expression result types used by the CSE table.
pub use ;
pub use CsePass;
/// CSE test suites — adversarial cases for literal aliasing and non-literal
/// subexpression merging.