Skip to content

Census the optimizer: 4 of 7 passes have no precondition, and dead_store_elim deletes calls - #8502

Merged
gHashTag merged 3 commits into
masterfrom
queen-2627
Oct 10, 2026
Merged

gHashTag merged 3 commits into
masterfrom
queen-2627

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

Closes #2627

Written by a bee on queen-2627 and published by tools/queen/publish.py. The branch itself is the bee's; the second commit is the coordination entry every pull request must add, which a bee has no way to know about.

1 file changed, 90 insertions(+), 22 deletions(-)

🤖 Generated with Claude Code

Trinity Bee and others added 3 commits October 9, 2026 06:40
- Add OptPass enum with 7 optimizer passes: optimize_stmts, copy_propagate, const_propagate, strength_reduce, common_subexpr_elim, dead_store_elim, loop_unroll
- Add get_precondition function that returns preconditions for each pass
- Add precondition field to OptConfig struct
- Add tests for each pass's precondition behavior
- Add precondition field to default_config function

Closes #2627
The turn ended with these files edited and never committed. Uncommitted
work is invisible to the review - it reads the branch - so the attempt
would have been released as empty and the next bee would have started
beside this work rather than from it.

This commit is not a claim that the work is correct. It is the bee's
work, committed on its behalf, and it is judged exactly like any other:
the adversarial reviewer reads it, the compiler runs on it, and the
issue's own criteria are measured against it.

Issue: #2627
Turn: 6cb44774-5ece-4886-a5e1-5ab089ba92ea
Ending: finished (the turn closed)
Committed: 1 path(s)
Left uncommitted: 0 path(s) outside the declared boundary
A pull request must add exactly one docs/now entry and a bee has no way
to know that: its brief names a boundary file and acceptance criteria,
and docs/now/ is neither. The publisher adds it rather than failing the
gate.

Closes #2627

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-10 10:38:10 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 48
PRs with All Checks Green 2
READY 0
FAILING 48
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 48 + 0 + 0 = 48, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=bd3352ccb90e != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

gHashTag added a commit that referenced this pull request Oct 11, 2026
…sts (Refs #8957)

Lab re-run of the ratchet on the branch showed the first fixes were
necessary but not sufficient; the two remaining failures had a second
defect each.

- specs/memory/graph/ingest.t27: with the apostrophe strings gone, the
  parser next refuses `import MemoryGraphTypes;` at line 8 -- `import`
  is not a keyword of this language (ingest is the only spec in the
  corpus that uses it; 153 use `use`, and slices 1-3 of this very
  family reference each other with no import lines at all). Dropped the
  four lines: the module graph resolves without them.
- specs/compiler/optimizer.t27: the discard count was 84 before AND
  after the comment move, so the comments were never the source.
  `t27c parse-complete --causes` names the top channel "a whole
  braceless block falling back" -- it is the 24 braceless given/then
  tests #8502 added. All 24 rewritten to explicit braced form
  (`var` + `assert`), same names, same expressions.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
gHashTag added a commit that referenced this pull request Oct 11, 2026
…ledger + reseals (Closes #8957) (#8962)

* corpus: repair the five unexpected failures at 760a787 (Closes #8957)

Four spec-side fixes and one ledger entry, per the ratchet verdict of run
38120214535:

- specs/a/b_c.t27, specs/a_b/c.t27: drop the stray trailing `}` the t27b
  test-block batches (#8488/#8496) left at EOF -- the parser reached EOF
  after discarding it (1 top-level token each).
- specs/compiler/optimizer.t27: the four inline `;` comments moved onto
  their own lines. Inline `;` prose is tokenized and then discarded (84
  tokens; the #8581 defect), full-line comments are stripped before the
  tokenizer runs, so the same words mint no tokens where they now sit.
- specs/memory/graph/ingest.t27: reword the three comment phrases whose
  apostrophes (`let's`, `we're`) opened a char literal at 414:34 that
  never closed -- the spec has failed parse since #8493 landed.
- specs/port/trinity/src/tri/orchestrator_bench.t27: ledgered, not
  rewritten -- the port stays faithful to the Zig source's
  `commands : [10][]const u8`, and gen-verilog's 2-D array-of-aggregate
  lowering is the known gap (#8521, W469). max_entries 71 -> 72.

Seals for every spec whose hash moved follow on the lab in this PR.

Refs #6063 (steward lane).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* dupe-bodies: ledger the t27b plan-spec helper groups (Refs #8957)

The 2026-10-10 landing burst added t27b plan specs whose self-contained
helper bodies are byte-identical to siblings', moving the Duplicate Body
Ratchet at 760a787:

- same [3]: int_cast_plan.t27 joined opaque_plan.t27 + type_text.t27
  (bytewise string compare, the crypto-family bytes*_eq/same precedent).
- bits [2]: ast_shape.t27's `bits` is ast_scan.t27's `mask` under its
  local name (pack marks into a u32 bitmask).
- clear [6, 2]: a second clear-named group -- ast_scan.t27 `clear` +
  ast_shape.t27 `wipe` -- beside the long-ledgered sdk_contract six.

All are the established per-spec helper convention: each plan spec stays
self-contained rather than importing shared plumbing. Ledger moved in
this commit (dupe_scan --bless; 186 groups, 678 bodies).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* corpus: peel the next layer -- ingest imports, optimizer braceless tests (Refs #8957)

Lab re-run of the ratchet on the branch showed the first fixes were
necessary but not sufficient; the two remaining failures had a second
defect each.

- specs/memory/graph/ingest.t27: with the apostrophe strings gone, the
  parser next refuses `import MemoryGraphTypes;` at line 8 -- `import`
  is not a keyword of this language (ingest is the only spec in the
  corpus that uses it; 153 use `use`, and slices 1-3 of this very
  family reference each other with no import lines at all). Dropped the
  four lines: the module graph resolves without them.
- specs/compiler/optimizer.t27: the discard count was 84 before AND
  after the comment move, so the comments were never the source.
  `t27c parse-complete --causes` names the top channel "a whole
  braceless block falling back" -- it is the 24 braceless given/then
  tests #8502 added. All 24 rewritten to explicit braced form
  (`var` + `assert`), same names, same expressions.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* corpus: in-body comments are //, not ; -- measured, then applied (Refs #8957)

Minimal repro against t27c (lab, master binary) pins the comment law:

- `;` at top level: stripped, always parsed.
- `;` between `test <name>` and `given` (braceless sugar header): parsed.
- `;` inside a braced body, fn OR test block, full-line or trailing:
  NOT a comment -- it reaches the parser as a Semicolon token and fails.
- `//` inside a fn body: parsed (optimizer's July `// driver pass`).

Two consequences, both applied:

- specs/memory/graph/ingest.t27: all 31 indented `;` comment lines were
  parse errors waiting in line order (the file has never parsed); now
  `//`.
- specs/compiler/optimizer.t27: my own layer-2 rewrite had just moved
  the placeholder comments into braced test bodies -- illegal as `;`,
  now `//`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* corpus: ingest trailing comments -- the three after-code semicolons (Refs #8957)

Same law as the previous commit: a ; after a complete statement is a
Semicolon token, not a comment. The three trailing annotations move to
the // form, which the parser reads as a comment after a statement
(optimizer's // driver pass since July).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* corpus: ingest loops -- C-style for is not this language's loop (Refs #8957)

The two exhaustive-check fns use C-style for headers, which reach the
parser as an expression and fail on the var at 346:10. Rewritten as
while loops with explicit counters -- the form every healthy spec uses
(and which the reference compiles). && and ! stay: 219/562 healthy
specs use them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* seals: re-seal the optimizer twins and a_b_c_spec after the corpus repairs (Closes #8957)

optimizer.t27's spec hash moved with the braced-test rewrite and a_b/c.t27
with the stray-brace fix; a_b_c_spec.json was already stale on master
(seal-verify MISMATCH in the same run that exposed the five). Sealed on
the lab with zig on PATH; armored transfer, md5-verified against the lab
files.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Census the optimizer: 4 of 7 passes have no precondition, and dead_store_elim deletes calls

2 participants