From 3a4eac272e5c62987f6d159e57ee3c7c0499026a Mon Sep 17 00:00:00 2001
From: Drew T <50529377+Druthulu@users.noreply.github.com>
Date: Mon, 31 Aug 2026 14:37:16 -0600
Subject: [PATCH] =?UTF-8?q?docs(cookbook):=20=C2=A7353=20-fno-thread-jumps?=
=?UTF-8?q?=20as=20a=20pass-identification=20oracle;=20launder=20the=20val?=
=?UTF-8?q?ue=20to=20keep=20a=20dead=20re-test?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/cookbook-index.md | 7 +++++--
docs/matching-cookbook.md | 23 +++++++++++++++++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/docs/cookbook-index.md b/docs/cookbook-index.md
index 230fdbab0..54144635b 100644
--- a/docs/cookbook-index.md
+++ b/docs/cookbook-index.md
@@ -2,7 +2,7 @@
> **Generated by `tools/cookbook_index.py` — do not hand-edit** (R33). Regenerate after adding a cookbook section.
>
-> `docs/matching-cookbook.md` is ~716 KB / 1003 sections. Grepping it blind is how three P30 wave-1 agents each "discovered" an idiom that was already written down. **Start here, then read the section.** A section appears under every symptom it addresses.
+> `docs/matching-cookbook.md` is ~716 KB / 1004 sections. Grepping it blind is how three P30 wave-1 agents each "discovered" an idiom that was already written down. **Start here, then read the section.** A section appears under every symptom it addresses.
**How to use:** name what you SEE in the diff (a stolen delay slot, an extra `la`, a swapped register pair, a `conflicting types` error), find that symptom below, read those sections first. If nothing fits, THEN grind — and add a section when you win.
@@ -937,7 +937,7 @@
- **§324** — THE ARITY-SELF WALL NEEDS *BOTH* HALVES: A K&R DEFINITION **AND** A NO-PROTO TU DECL; EITHER ALONE STILL FAILS (P31 S67; rtu-proven ov_SC01_005/func_8017FBCC, 14 instances measured) L30949
- **§337** — THE CC1-ONLY BLOCKER CLASS: `blocker_probe`'s STATIC ORACLE REPORTS "none" AND THE WHOLE-TU COMPILE STILL FAILS (P31 S67; ov_SC04_011/func_801827DC, md_MAIN_027/func_800CB4A4) L31157
-### build graph, splat & the harness (181)
+### build graph, splat & the harness (182)
- **§4** — Flag/toolchain gotchas L190
- **Build** — mechanism — per-file opt override (splat resegmentation) L307
@@ -1120,6 +1120,7 @@
- **§337** — THE CC1-ONLY BLOCKER CLASS: `blocker_probe`'s STATIC ORACLE REPORTS "none" AND THE WHOLE-TU COMPILE STILL FAILS (P31 S67; ov_SC04_011/func_801827DC, md_MAIN_027/func_800CB4A4) L31157
- **§340** — §194-K COROLLARY: **FLIP THE FALSE EDGE YOU CANNOT DELETE.** A "scheduler" residual can be sched.c's ALIAS ORACLE emitting a FALSE true-dependence; source order chooses its DIRECTION (P31 S67; byte-proven ov_SC03_107/func_8017CF48, 10 -> 0 in one compile, zero bytes) L31209
- **§346** — `c ? X : -X` TAKES expand_expr's COND_EXPR **SINGLETON** PATH (copy, then negate IN PLACE) — AN if/else STATEMENT GIVES THE TWO-ARM FORM (P31 S67; byte-proven ov_SC03_102/func_80180C38, closed the last instruction) L31322
+- **§353** — USE `-fno-thread-jumps` AS AN **ORACLE** TO PROVE A RESIDUAL IS thread_jumps, THEN LAUNDER THE *VALUE* TO KEEP A DEAD RE-TEST (P31 S67; byte-proven ov_SC01_008/func_8017EC68, 279 ins) L31519
### process, measurement & doctrine (122)
@@ -2553,6 +2554,7 @@
- **§350** — A ZERO-BYTE RE-TIE SETS `reg_n_sets=2`, WHICH KILLS sched1's `birthing_insn_p` LAUNCH_PRIORITY BOOST — THE MECHANISM BEHIND "MY ADDS ARE GLUED TO THEIR STORES" (P31 S67; byte-proven ov_SC04_011/func_80180B24, 215 ins) L31435
- **§351** — `/s` (MEM_IN_STRUCT_P) IS A DIAL YOU CHOOSE PER ACCESS: A COMPONENT_REF GRANTS IT AND LETS cse KEEP AN INDEX ACROSS THE STORE; A PLAIN CAST DENIES IT (P31 S67; ov_SC01_000/func_8017DD04, 186 -> 5) L31456
- **§352** — ⚠ TWO IDENTICAL `__asm__ __volatile__("")` BARRIERS **MERGE WITH EACH OTHER** — SPELL THE SECOND ONE DIFFERENTLY (P31 S67; byte-proven resident/func_800D128C, measured closeness 105 when they merged) L31486
+- **§353** — USE `-fno-thread-jumps` AS AN **ORACLE** TO PROVE A RESIDUAL IS thread_jumps, THEN LAUNDER THE *VALUE* TO KEEP A DEAD RE-TEST (P31 S67; byte-proven ov_SC01_008/func_8017EC68, 279 ins) L31519
---
@@ -3568,3 +3570,4 @@ Notes routinely quote that as a section id. This table resolves it. Grep bait: `
| L31435 | §350 | A ZERO-BYTE RE-TIE SETS `reg_n_sets=2`, WHICH KILLS sched1's `birthing_insn_p` LAUNCH_PRIO |
| L31456 | §351 | `/s` (MEM_IN_STRUCT_P) IS A DIAL YOU CHOOSE PER ACCESS: A COMPONENT_REF GRANTS IT AND LETS |
| L31486 | §352 | ⚠ TWO IDENTICAL `__asm__ __volatile__("")` BARRIERS **MERGE WITH EACH OTHER** — SPELL THE |
+| L31519 | §353 | USE `-fno-thread-jumps` AS AN **ORACLE** TO PROVE A RESIDUAL IS thread_jumps, THEN LAUNDER |
diff --git a/docs/matching-cookbook.md b/docs/matching-cookbook.md
index b571c2c59..d3bf5548c 100644
--- a/docs/matching-cookbook.md
+++ b/docs/matching-cookbook.md
@@ -31515,3 +31515,26 @@ Two ordinary fixes worth the pattern: a clamp must be `if/else` plus a SEPARATE
because a `?:` const-folds `0x14*25` to 500; and the definition needed `(s32 arg0, s32 arg1)` with
`(u8)`/`(s16)` casts INSIDE, because `resident.c:1693` already declares the prototype at file scope
(gcc-2.7.2 rejects `+` asm constraints).
+
+## §353 — USE `-fno-thread-jumps` AS AN **ORACLE** TO PROVE A RESIDUAL IS thread_jumps, THEN LAUNDER THE *VALUE* TO KEEP A DEAD RE-TEST (P31 S67; byte-proven ov_SC01_008/func_8017EC68, 279 ins)
+
+A surviving "dead" `bne $s0,$v1` re-test in the target looks impossible to reproduce: `thread_jumps`
+deletes the label, and cse then folds the comparison away. §308 read in REVERSE gives the lever —
+**launder the VALUE, not the control flow**:
+
+ __asm__("" : "=r"(w) : "0"(w)); /* in place, on an s32 w */
+
+With the value laundered, cse can no longer prove the comparison redundant and the re-test survives.
+
+**THE DIAGNOSTIC IS THE REUSABLE PART:** compile once with **`-fno-thread-jumps`**. If the residual
+disappears, the pass is identified and you are looking for a value/label-liveness dial, not a
+scheduling or allocation one — here it took the count 4 → 1 immediately and named the target. Add it
+to the same toolbox as `oracle_reorder.py` (proves an `as -O1` epilogue wall) and `cc1 -dS`/`-dL`
+(prove a sched1 priority or a loop.c threshold): **a per-pass disable flag is a cheap oracle for
+"which pass is doing this".**
+
+Also from this function, and it is the §347/§162 pattern again: the shared
+`D_801A3458 = p; beep; return 0;` tail must be a source-level `goto` placed in case 0's LAST arm —
+leaving it to cross-jumping gives **341 instructions against the target's 279**. Cross-jumping
+re-merges what you duplicate (§347 lever 1), but it will not INVENT the jump structure a source
+`goto` expresses.