Repository navigation
t27b: SSA INC-IF fold — hot loop 9→8 instructions, beats GCC -O2's 10 (see #14012) - #14027
Merged
Merged
Conversation
… reads the old w via ordered selects; bench_audit hot loop 9 -> 8 insns, beats GCC -O2's 10 (see #14012)
Contributor
Collaborator
Author
|
Decision summary for the merge review (owner request, 2026-11-16):
Treat this PR as a code-size improvement pending a repeatable wall-clock protocol (fixed host, N>=10 interleaved runs, min and median reported) before any performance claim. Merge decision is the owner's. |
Collaborator
Author
|
Wording correction to the decision summary above (owner, 2026-11-16): The
What IS established: the instruction-count improvement over OLD (9 -> 8) and over GCC -O2 (10 -> 8), and 0 A/A regressions (268 files). Nothing else is claimed. |
This was referenced Nov 16, 2026
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.
see #14012 #12871 #13453
(the LICM half of #14012 already landed on master inside the t27b release squash; this lands the SSA half)
Boundary
bench_audit hot loop was 9 instructions after the LICM half; clang -O2's shape
is 7. The gap is the increment-in-place:
w = w + cdestroys the old value thatan arm
w - cneeds, so t27b emitted a separate sub. This PR removes it.What landed
ssa_inc_facts— the four gates of the INC-IF fold(step adjacent, arms assign-only, exactly one branch defines w, every w-read is
the fold
w - cor a plain new-value read). 5 tests.arm_reads_ok_ordered+select_may_emit— withordered emission a plain-local arm may read a selected local when the read's
select emits BEFORE that local's select (the read lands on the pre-select home).
The old law stays for un-ordered callers. 6 tests.
ssa_local_inc(runs before homes are planned): rewritesw = w + c; if (w cmp k) ... else ...tovt = w + c; if (vt cmp k) ... else ...; w = vt— same op (a checked add keeps its trap site), fresh__t27b_ssaNtemp, the fold arm reads w's home (old value).
ifconv: ordered select emission (reader first, read local last), gated by thenew law; mutual-read pairs bail.
Evidence
csel prev [reads OLD w], csinc w, sub count, cbnz) — now 2 fewer than GCC -O2's
10 for the same source.
regressions; the 2 queen fails are pre-existing (same in runs/ref_complete.txt).
--check0 mismatches.— the loop is dependency-chain bound; the removed instructions were off the
critical path, so the win shows in code size, not yet in wall clock.
Constraints