You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Record the 2026-07 Mach-O corpus sweep in the TODO backlog
First pairscan/defuse run over macOS binaries: go 1.26.5 (1.47M
insns), rustup (1.62M), and librustc_driver stable (25.9M). A new
window-candidates section carries the two real beyond-adjacency
populations the distance histograms surfaced -- same-address reloads
(~18.2k in librustc_driver, d4-7 dominant, relaxed-atomic caveat
keeps it opt-in) and the zero-CMP S-variant tail -- while the
add+add coalesce row gains counts plus the changed-destination
generalization, the adrp+add row its cross-corpus frequencies, a new
binary-aware row covers adrp+ldr literal-pool constants, and a
microarch row covers the scratch-ADD LDP/STP split.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: TODO.md
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ the existing checks.
17
17
| zero-CMP→S-variant: `adc`/`sbc` producers |`adcs`/`sbcs`| Excluded in v1: they read the carry the deleted compare set; needs a separate flag argument |
18
18
| sign CSET/CSETM: GE/PL complements |`lsr`+`eor #1` / `mvn`+`asr`| 2-for-2, no size win (frees NZCV only); v1 of the sign-shift fold flags LT/MI |
|`add x0, x0, #a ; add x0, x0, #b`| one `add`/`sub`| Coalesce adjacent same-register immediate adjustments; skip the canonical imm12 + imm12<<12 pair the assembler splits |
20
+
|`add x0, x0, #a ; add x0, x0, #b`| one `add`/`sub`| Coalesce adjacent same-register immediate adjustments; skip the canonical imm12 + imm12<<12 pair the assembler splits. 2026-07 sweep: 15,350 adjacent dep pairs of this shape in librustc_driver (313 rustup, 12 go), many with a changed destination (`add x8, x8, #0xec0 ; add x0, x8, #0x28`) -- generalize via the dead-producer scan|
21
21
22
22
## Branches and dead code
23
23
@@ -57,7 +57,8 @@ The largest untouched family; none of these need liveness machinery.
57
57
58
58
| Pattern | Rewrite | Notes |
59
59
| --- | --- | --- |
60
-
|`adrp` + `add` → `adr` (target within ±1MB) | shorter form | Actionability caveat: linker-resolved relocations make this a relink-level suggestion; likely opt-in |
60
+
|`adrp` + `add` → `adr` (target within ±1MB) | shorter form | Actionability caveat: linker-resolved relocations make this a relink-level suggestion; likely opt-in. 2026-07 sweep: the most frequent dependent pair in every corpus -- 59.7k go, 42.5k rustup, 642k librustc_driver |
61
+
|`adrp` + `ldr Sd/Dd/Qd` from a literal pool |`fmov #imm8` / `movi` when the pointed-to constant encodes | 24.3k `adrp`+`ldr d` pairs in librustc_driver; needs reading the target section's bytes at the resolved address -- same relink caveat and infrastructure as the rows above |
61
62
| BR fold for general registers (`adr x8, L ; br x8`) |`b L`| v1 folds x16/x17 only (veneer-scratch ABI argument); the general case needs liveness at the TARGET, a new scan mode |
62
63
| mov-wide address chains → `adr`/`adrp`+`add`; `mov`+`blr` → `bl`| shorter form | Same actionability caveat as adrp+add |
63
64
@@ -75,6 +76,20 @@ The largest untouched family; none of these need liveness machinery.
75
76
| Split fusion pairs (cmp+b.cond, aese+aesmc same-dest, adrp+add) | Informational: "these should be adjacent"; per-core tables from the SOGs |
76
77
| Render `mov xd, #0` (not `mov xd, xzr`) and `movi v0.2d, #0` (not `movi d0, #0`) | Apple eliminates only those spellings at rename; rendering tweaks to existing checks |
77
78
| Loaded value as base not offset (`[x9, x8]` → `[x8, x9]` when x8 was just loaded) | Apple guide §4.6.7: 1 cycle of address-generation latency |
79
+
| LDP/STP synthesized through a scratch ADD (`add x27, xN, #big ; ldp x3, x4, [x27]`) → two plain `ldr`/`str` with the offset folded in | Size-neutral 2-for-2 that drops the ADD from the address dependency chain and frees the scratch; gc emits it whenever a pair offset exceeds ±504 or is 8-misaligned (~13k in go), LLVM for big Q-register spill offsets (~9k in librustc_driver); requires the split offsets to encode (scaled imm12, or LDUR/STUR range) |
80
+
81
+
## Window candidates (2026-07 corpus sweep)
82
+
83
+
First `pairscan`/`defuse` sweep over macOS Mach-O binaries: `go` 1.26.5
84
+
(1.47M insns), `rustup` (1.62M), and `librustc_driver` stable (25.9M).
85
+
The defuse distance histograms show d1 dominating every sole-use
86
+
producer family, confirming strict adjacency as the right default; the
87
+
populations below are the real beyond-adjacency mass.
88
+
89
+
| Pattern | Rewrite | Notes |
90
+
| --- | --- | --- |
91
+
| Same-address reload: second `ldr`/`ldrb`/`ldrh` of an untouched `[Rn, #d]` with no store/call/barrier between | reuse the first value (delete the reload, or copy the first destination) |~18.2k in librustc_driver (d4-7 dominant), ~830 rustup, ~320 go. Signature shape: chained keyword-compare arms clobber the loaded register to materialize the next `ccmp` constant, then reload both fields. Deletion cannot meet the hard soundness bar -- a plain LDR may be a relaxed atomic, so a concurrent writer is architecturally visible -- so this is opt-in/informational class material |
92
+
| Zero-CMP → S-variant with a 1-2 instruction gap | as the adjacent fold | go `cmp0\|and`: 72 at d2, 10 at d3 vs 42 at d1 -- gc's non-adjacent tail rivals the adjacent population; same flag-liveness scan, wider match |
0 commit comments