nx_opt_eqsat_wire_gate.nx
buildroot/runtime/nx_opt_eqsat_wire_gate.nx
about
nx_opt_eqsat_wire_gate.nx -- GATE for LN8 "equality saturation CONSUMED by the backend"
(lang.plan rung LN8, symbol opt_eqsat_pass). nx_opt_eqsat_pass_gate proves the PASS on an
in-memory IR fixture; THIS gate proves the SHIPPING PIPELINE runs it: the toolchain compiler
(argv[1], default the live builder) is driven over runtime/nx_eqsat_wire_probe.nx with --ir-dump
and the post-opt IR is read back.
Observables (both measured 2026-08-23 on the first wired build, neither assumed):
* ewp_xor_self (x ^ x, x a runtime param): the xor folds to the constant 0 through the e-graph
and is then dead-code-eliminated, so the dump carries NO `op=12` line whose operands are the
SAME value id; the emitted asm goes from `xorq %rcx, %rax` to `movabsq $0, %rax`.
* ewp_xor_pair (x ^ y, distinct params): the xor SURVIVES -- exactly one `op=12` line with
o0 != o1. This is the anti-vacuity control: a pipeline that deleted every xor would fail it.
* Behaviour is unchanged: the probe exits argc+3 with and without the pass (exit 4 unarg'd).
A pre-LN8 compiler (no pass in opt_run) fails the fold tooth and keeps both xors; a pre-LN8 compiler
without --ir-dump fails the dump-present tooth too -- both are the bite, attributable.
Driver = nx_ccgate_lib. Data captures in /tmp/nxeqw/, RUNNABLES under _build/ (NAS /tmp noexec).
Usage: nx_opt_eqsat_wire_gate [compiler_elf] (CWD = the tree root, like nx_cc_equiv_gate)
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_ccgate_lib.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 25 | const EWG_EXPECT_EXIT: i64 = 4 |
functions
| 30 | func ewg_count_xor(path: *u8, out: *i64) -> i64 |
| 62 | func ewg_field(b: *u8, lo: i64, hi: i64, key: *u8, kl: i64) -> i64 |
| 86 | func main(argc: i64, argv: *i64) -> i64 |