Repository navigation
t27b: countdown liveness guards !inner + !stmts_has_var(rest,iv) (#13451) - #13452
Merged
Merged
Conversation
…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
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>
Contributor
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.
Fixes 8 UNEXPECTED FAILURES in
t27b-native-ratchetintroduced by the countdown transform in PR #13447.Root cause
The countdown guard at lower.rs:7810 for the new
writes(body, iv) == 1case lacked:!inner— when the step is in a nested scope,check_elidedoes not fire and the step remains a trappingAdd; countdown then changed it toSubW, removing a trap and shifting all subsequent trap-site numbers → jit/interpreter site mismatch ingraph_transition.t27.!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_audithot loop: iv not inrest, step not nested → countdown still fires → 10-word target preserved.Closes #13451
🤖 Generated with Claude Code