Skip to content

t27b: countdown liveness guards !inner + !stmts_has_var(rest,iv) (#13451) - #13452

Merged
gHashTag merged 3 commits into
masterfrom
lane/t27b-golden-measure
Nov 9, 2026
Merged

gHashTag merged 3 commits into
masterfrom
lane/t27b-golden-measure

Conversation

@gHashTag

@gHashTag gHashTag commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Fixes 8 UNEXPECTED FAILURES in t27b-native-ratchet introduced by the countdown transform in PR #13447.

Root cause

The countdown guard at lower.rs:7810 for the new writes(body, iv) == 1 case lacked:

  1. !inner — when the step is in a nested scope, check_elide does not fire and the step remains a trapping Add; countdown then changed it to SubW, removing a trap and shifting all subsequent trap-site numbers → jit/interpreter site mismatch in graph_transition.t27.
  2. !stmts_has_var(rest, iv) — countdown changes iv's final value from N to 0; any post-loop read of iv got 0 instead of N, failing 7 conformance and corpus specs.

Both variables (inner, rest) were already in scope at the countdown block.

Change

One line in cli/t27b/src/lower.rs — 1 insertion, 1 deletion. Net: 0 foreign lines.

Verification

bench_audit hot loop: iv not in rest, step not nested → countdown still fires → 10-word target preserved.

Closes #13451

🤖 Generated with Claude Code

gHashTag and others added 2 commits November 9, 2026 21:23
…bench_audit

ifconv rejected the else arm cur_prev = cur_tick - 1 because u64 subtraction
lowers to ArithOp::SubW; extend the Arith match to include AddW and SubW.

countdown guard required writes(body, iv) == 0, but t27 while loops always
put the step i = i + 1 in body (step vec is empty); unified condition accepts
either step-in-body or step-in-step, and flips direction by processing both
slices (only the one with the iv write changes).

golden_spec.t27: licm_body_const saves 0 words for bench_audit (1000 fits in
one movz; licm_hoist_const requires insns_to_build >= 2). Expected measurement
after fixes: 10 words. GCC -O2: 10 words. Net savings from naive: 11 words.

Closes #13446
Refs #12871

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…loses #13451)

Add two safety guards to the countdown transform in elide_checks (lower.rs):
  1. !inner: prevent firing when the step is in a nested scope, where
     check_elide cannot have elided the trap; a trapping Add would otherwise
     be changed to SubW, shifting trap-site numbers and causing jit/interpreter
     mismatches (graph_transition.t27 site-45-vs-46).
  2. !stmts_has_var(rest, iv): prevent firing when iv is read after the while
     loop; countdown changes iv's final value from N to 0, corrupting all
     post-loop reads.  Fixes 8 UNEXPECTED FAILURES in t27b-native-ratchet.

bench_audit is unaffected: iv not in rest, step not nested.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gHashTag
gHashTag enabled auto-merge (squash) November 9, 2026 14:57
…conflict)

Take HEAD version of lower.rs:7810: the !inner and !stmts_has_var(rest,iv)
guards from this branch supersede the base countdown condition from master.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-11-09 15:00:38 UTC

Summary

Status Count
Total Open PRs 43
PRs with Failing Checks 38
PRs with All Checks Green 5
READY 4
FAILING 38
PENDING 0
NO CHECKS YET 0

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=b882be1e4933 != 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
gHashTag merged commit de4bfd0 into master Nov 9, 2026
39 of 42 checks passed
@gHashTag
gHashTag deleted the lane/t27b-golden-measure branch November 9, 2026 15:02
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.

t27b: countdown liveness -- guard !inner and !stmts_has_var(rest, iv)

1 participant