diff --git a/docs/matching-cookbook.md b/docs/matching-cookbook.md index 8c300503e2..91a04f3c4f 100644 --- a/docs/matching-cookbook.md +++ b/docs/matching-cookbook.md @@ -3155,3 +3155,55 @@ The 399-ins flagship — a "whole-function register permutation" that walled the **Lever D — goto-shared-return isolates the exit `li` (tail).** A common `return 1` reached by `goto ret1:` gets its OWN basic block → stops sched1 hoisting the exit `li v0,1` into a last-element load-delay slot cross-BB (freeing `$v0` for a trailing temp); dbr still steals the `li` into the branch delay slot. Use when a return-constant materializes one instruction too early. **Transfer caveat (the §44 meta-lesson holds):** each giant is its own class — Levers A/B are regalloc-**permutation** tools; apply them to a walled giant only when its residual IS a merged-variable or 2-set-temp permutation (read the `.greg`/`.lreg` tell first). The Phase-25 flywheel applies A–D via cheap-Opus to the sibling walled giants (`func_8014D820` RC-6, `func_801670E4`, `func_8016CBC0`), escalating to Fable5 only for a genuinely new class. + +## §46 — The `func_80178D40` crack (890 ins ×134, the heaviest core in the game): four LOOP-STRUCTURE levers cheap-Opus found by reading loop.c/jump.c/cse.c (Phase 26 session 8, 2026-07-13) + +The heaviest jr core (890 ins, reach 134 = 477 KB) sat at **close=39 with every case byte-exact but one**. All 39 +residuals lived in a single 44-instruction case body. **No pins, no permuter** — every residual was *structural*, +and the permuter could not have reached any of them. Cheap-Opus + the §31 map closed it to **MATCH 890/890**. +These four levers are new and general; the classes recur in every loop-bearing overlay function. + +**L1 — A loop's `break` must NOT land on the loop's own fall-through label (the PEEL lever).** +When a `break` target *coincides* with the loop's natural fall-through exit, the RTL leaves `NOTE_INSN_LOOP_BEG` +followed by an unconditional jump — which fires `duplicate_loop_exit_test` (`jump.c:2131`, called from +`jump.c:599`). gcc **rotates the loop and peels iteration 1**; if the induction variable is provably 0 the peeled +`i++` const-folds (`li $a2,1`) and drags a whole `lui/addiu/lw` address re-materialization block with it. +**Fix: write `goto