Skip to content

refactor(compile): lay out blocks through graph.Order - #349

Merged
siyul-park merged 2 commits into
mainfrom
refactor/layout-order
Nov 19, 2026
Merged

siyul-park merged 2 commits into
mainfrom
refactor/layout-order

Conversation

@siyul-park

Copy link
Copy Markdown
Owner

Summary

compile.(*lowering).layout re-implemented graph.Order's iterative reverse-postorder DFS to change one thing: a two-way loop branch visits its loop-staying successor last, so it falls through. It now precomputes those successor lists once (no per-step allocation) and walks them with graph.Order through a small laid view. One DFS serves every reverse-postorder caller. −13 lines.

Fourth of the pipeline structural cleanups (after #346, #347, #348).

Evidence

  • Block order unchanged: every compile and arm64 golden passes untouched.
  • Mutation check: dropping the successor swap turns TestLower red, so the contract stays pinned.
  • make benchmark-diff base=5a3ef12 (interleaved, n=6): geomean +0.14%; no significant change on any jit row (significant rows are threaded/optimized, which this PR cannot reach).

Test plan

  • go test ./internal/jit/... ./interp
  • make check
  • git diff --check

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e81b2596-595b-4f87-9431-0bac4201f354
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

layout re-implemented graph.Order's iterative reverse-postorder DFS to
change one thing: a loop branch visits its staying successor last. It
now precomputes those successor lists and walks them with graph.Order,
so one DFS serves every reverse-postorder caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@siyul-park
siyul-park force-pushed the refactor/layout-order branch from 2804191 to e0893e5 Compare November 19, 2026 13:25
@siyul-park
siyul-park merged commit acf4501 into main Nov 19, 2026
1 check passed
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.

1 participant