Skip to content

t27b: SSA value-tracking + LICM imm12 hoist -- 10 -> 7 hot-loop instructions on bench_audit #14012

Closed as not planned

Description

@gHashTag

see #12871 #13453

Boundary

bench_audit hot loop emits 10 instructions per iteration; clang -O2 emits 7
for the same source. Quiet re-measurement 2026-11-16: t27b JIT about
1.9 ns/call, clang -O2 about 1.25 ns/call on this M-series Mac
(2026-11-15 "parity" was machine-load noise; corrected in release notes).

User scenario

Spec authors get about 1.5x slower loops than an optimizing C compiler on
dependency-chain-bound witnesses.

Requirements (from the asm diff, evidence in release notes)

  1. SSA value-tracking: fold sub(add(x,c),c) back to x across the step and
    the ifconv arm (clang: csel reads the OLD cur, no add/sub pair). Home:
    PASS_SSA (STATUS_MISSING, DISP_BLOCKER in middle_end.t27).
  2. LICM: hoist the loop-invariant imm12 const materialization
    (movz fix(compiler): W106 from_mhz unit error (1000x) (Closes #984) #1000) out of the loop. Home: PASS_LICM (STATUS_MISSING,
    DISP_BLOCKER). PASS_LICM_CONST hoists only wide movz+movk today.
  3. Both land spec-first in middle_end.t27 with negative controls, then
    corpus A/A, then this bench.

Success criteria

  • hot loop at most 8 instructions, measured ns/call at or under clang -O2
    on the same host;
  • 0 corpus A/A verdict changes;
  • golden_spec words ledger updated with the new gap (negative if t27b
    beats GCC -O2's 10).

Next report

Lane PRs per pass; before/after asm and ns/call.

Activity

  1. added
    shape-refusedClosed by the issue-shape gate (specs/policy/issue_shape.t27); a passing edit reopens it
    on Nov 15, 2026
  2. github-actions commented on Nov 15, 2026

    @github-actions
    Contributor

    Closed by the issue-shape gate (specs/policy/issue_shape.t27, #7498): an issue must have the template's sections. Edit the body; an edit that passes reopens it.

    • missing: ## User Scenarios -- at least one Given/When/Then scenario
    • missing: ## Requirements -- numbered obligations, FR-001: ... MUST ...
    • missing: ## Success Criteria -- an outcome a machine can settle: a number with a unit, a backticked file, exit 0, or a backticked command
  3. gHashTag commented on Nov 15, 2026

    @gHashTag
    CollaboratorAuthor

    Split recorded 2026-11-16: the LICM half of this issue is ready for merge as PR #14019 (branch claude/ssalicm-14012, spec licm_loop_imm + codegen; hot loop 10 -> 9 insns, A/A 203 files 0 regressions, spec tests 14/14).

    The SSA half — folding sub(add(x,c),c) back to the old value so the ifconv arm reads the pre-increment register like clang's csel x21, x9, x20, hi — needs instruction scheduling / value-tracking across statements. That is PASS_SSA territory (STATUS_MISSING, DISP_BLOCKER in middle_end.t27); it stays open on this issue after the LICM PR lands. Interleaved bench on a loaded host: NEW 1.71 vs OLD 1.94 ns/call best-of-3; a firm wall-clock number needs the quiet host (lab runbook).

  4. gHashTag commented on Nov 15, 2026

    @gHashTag
    CollaboratorAuthor

    Reopened: the LICM half landed via PR #14019 (merge commit 3ec20ed on release/t27b-optimizer-parity-2026-11-15). The SSA half (fold sub(add(x,c),c) to the old value; PASS_SSA lane) stays open on this issue.

  5. github-actions commented on Nov 15, 2026

    @github-actions
    Contributor

    Closed by the issue-shape gate (specs/policy/issue_shape.t27, #7498): an issue must have the template's sections. Edit the body; an edit that passes reopens it.

    • missing: ## User Scenarios -- at least one Given/When/Then scenario
    • missing: ## Requirements -- numbered obligations, FR-001: ... MUST ...
    • missing: ## Success Criteria -- an outcome a machine can settle: a number with a unit, a backticked file, exit 0, or a backticked command
  6. gHashTag commented on Nov 15, 2026

    @gHashTag
    CollaboratorAuthor

    SSA half ready for merge: PR #14027 (branch claude/ssa-inc-14012-v2, based on master). INC-IF fold lands bench_audit at 8 hot-loop instructions -- 2 fewer than GCC -O2's 10; A/A 268 files 0 regressions; wall clock unchanged (~1.3 ns: the loop is dependency-chain bound, removed instructions were off the critical path).

  7. gHashTag commented on Nov 16, 2026

    @gHashTag
    CollaboratorAuthor

    Scope correction (owner, 2026-11-16): the landed SSA slice is the specific ssa_local_inc INC-IF fold plus ordered select emission — it is NOT the full PASS_SSA pass (no general value tracking, no live ranges). PASS_SSA stays STATUS_MISSING/DISP_BLOCKER in middle_end.t27; the disposition table should only change when the general pass lands. Also correcting the earlier wording: the 8-instruction state is a code-size win; the wall-clock <= clang criterion is not met (NEW ~1.36 vs clang ~1.2 ns, single quiet sample, no spread data).

  8. gHashTag commented on Nov 16, 2026

    @gHashTag
    CollaboratorAuthor

    Wording correction to the scope note above (owner, 2026-11-16): with PR #14027 still OPEN, the SSA slice is implemented on the branch (claude/ssa-inc-14012-v2) and PRESENTED as a PR — it is not landed, and must not be described as landed until that PR merges. What IS landed on master today: the LICM half (via the t27b release squash). The general PASS_SSA remains STATUS_MISSING / DISP_BLOCKER. And the <= clang criterion is unmet on both axes (instructions 8 > 7; wall clock NEW ~1.36 vs clang ~1.2 ns, single sample) — only the GCC -O2 instruction-count claim (10 -> 8) stands.

  9. gHashTag commented on Nov 16, 2026

    @gHashTag
    CollaboratorAuthor

    Reopened again: github-actions[bot] auto-closed this as NOT_PLANNED at 2026-11-15T19:45Z, 4 minutes after the manual reopen. The SSA PR #14027 is still OPEN; this issue stays open until it merges and the general PASS_SSA disposition question is resolved.

  10. github-actions commented on Nov 16, 2026

    @github-actions
    Contributor

    Closed by the issue-shape gate (specs/policy/issue_shape.t27, #7498): an issue must have the template's sections. Edit the body; an edit that passes reopens it.

    • missing: ## User Scenarios -- at least one Given/When/Then scenario
    • missing: ## Requirements -- numbered obligations, FR-001: ... MUST ...
    • missing: ## Success Criteria -- an outcome a machine can settle: a number with a unit, a backticked file, exit 0, or a backticked command
  11. added a commit that references this issue on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    shape-refusedClosed by the issue-shape gate (specs/policy/issue_shape.t27); a passing edit reopens it

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions