Repository navigation
refactor(graph): give natural-loop discovery one owner in graph.Loops - #347
Merged
Merged
Conversation
Headers → Body → Preheader was re-walked by LICM, BCE, the bytecode emitter, compile's scan, and analysis.Headers. graph.Loops now returns each natural loop with its body and preheader, innermost first (the order LICM sorted into), replacing the three exported walkers. LICM and BCE reached into each other's files (BCE's def-site index, LICM's inlet). Their shared loop machinery moves to transform/loop.go as nest. DCE keeps its own index: it indexes only reachable blocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This was referenced Nov 19, 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.
Summary
Headers → Body → Preheaderwas re-walked in five places: LICM, BCE, the bytecode emitter's layout, compile'sscan, andanalysis.Headers.graph.Loops(g, d) []Loopnow returns each natural loop with its body and preheader (-1when none), innermost first — the order LICM sorted into. It replaces the exportedHeaders,Body,Preheader(net −1 exported symbol).loops/site, LICM'sinlet). Their shared loop machinery moves totransform/loop.goasnest.graph/loop_test.gois oneTestLoopsowner (acyclic, single, nested order, merged back edges, non-dominating back edge, preheader present, three no-preheader shapes).Second of the pipeline structural cleanups (after #346).
Evidence
make benchmark-diff base=4d26392(interleaved, n=6): geomean +0.29%; no significant change on anyjitrow. The only significant rows arethreadedoroptimizedkernels whose code this PR cannot reach (threaded handlers are untouched; optimized output is unchanged), so they read as machine noise.Test plan
go test ./internal/graph ./analysis ./internal/ssa ./internal/transform ./internal/jit/... ./interp ./optimizemake checkgit diff --checkgrep -rn 'graph\.\(Headers\|Body\|Preheader\)'→ none🤖 Generated with Claude Code