feat(t27b): bench prose clauses lower to nothing; scalar fields set from a call - #6293
Merged
Merged
Conversation
…rom a call A bench written as prose clauses (`measure: nanoseconds to f(x)`, `target: < 100ns`) reaches lowering as childless StmtExpr nodes named `<clause>:`. t27c's Zig backend writes `// NOT LOWERED: empty statement` for each inside a bench fn nothing calls; t27b now lowers them to nothing inside a bench body and keeps rejecting them anywhere else. This is the largest of three unrelated StmtExpr shapes (89 of 104 files); top-level statements and the dotted-module stray `.b` stay rejected. Unblocking those files exposed two JIT/interpreter mismatches: a scalar struct field initialised from a call took the in-place path meant for an aggregate result and was never written. Lower::init now builds in place only for an aggregate type. Corpus: pass 223 -> 246, fail 3 -> 4 (gf16_dot4, same as the reference), rejected 711 -> 687, mismatch 0. Closes #6291 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6291
Refs #6063
What
StmtExprled the greedy order (+28 files) after #6289. Read per file it is three unrelated shapes; this PR takes the largest:empty statement: bench prose clause (measure: ...,target: < 100ns).bfrom a dottedmodule a.b;<clause>:; t27c's Zig backend writes// NOT LOWERED: empty statement -- statement rendered to nothing (T43)inside abench_<name>fn nothing calls. t27b lowers it to nothing only inside a bench body; outside one it stays a named rejection, so no test clause can be dropped silently.Lower::init, a scalar struct field initialised from a call (Out{ .result = mul(a, b) }) took the in-place path meant for an aggregate result (the call got a result pointer and the field was never written).in_placenow requiresis_agg(&t). Fixed here because the family cannot land with a mismatch.Tests
differential::bench_prose_clauses_lower_to_nothingsource::struct_field_initialised_from_a_scalar_call(negative control: fails with the oldin_place)cargo test -p t27b --release: all green.t27b corpus specs(master 47621f4 vs this branch, local, load avg ~16-20)24 files changed verdict, checked one by one with
t27c test-report(t27c built from the same master):intermediate_structureoverflows u16; the reference fails exactly that test (3 pass / 1 fail).count + 1abovevar count, filed as gen-zig CSE hoistscount + 1abovevar countand across its reassignment #6292;.align = 4, Generated Zig writes .align = 4, and align is a reserved word #4807). They stay outside the honest denominator.Greedy top 5 after:
StmtAssign(undeclared)+24,ExprCall(assert with message)+19,ExprIdentifier statement+18,FnDecl+15,ExprBinary statement+12. The remainingStmtExpr(15 files: top-level statements and dotted module names) drops to greedy step 30 (+7).The ratchet ledger
docs/reports/t27b_expectations.jsonis not touched here; the steward blesses it.🤖 Generated with Claude Code