Skip to content

Optimize localify (regalloc onto locals): - #20

Merged
cfallin merged 2 commits into
mainfrom
optimize-localify
Jul 27, 2026
Merged

Optimize localify (regalloc onto locals):#20
cfallin merged 2 commits into
mainfrom
optimize-localify

Conversation

@cfallin

@cfallin cfallin commented Jul 24, 2026

Copy link
Copy Markdown
Member
  • Use a bitset rather than a HashSet for the live-set fixpoint computation;
  • Use a dense index space consisting only of block-crossing values for those bitsets, to keep them smaller;
  • Use a local dense liveset datastructure that uses epoch-numbers-per-slot to allow O(1) clearing between blocks.

Overall, speeds up compilation on a very large input from ~173 seconds to ~7 seconds.

- Use a bitset rather than a HashSet for the live-set fixpoint
  computation;
- Use a dense index space consisting *only* of block-crossing values for
  those bitsets, to keep them smaller;
- Use a local dense liveset datastructure that uses
  epoch-numbers-per-slot to allow O(1) clearing between blocks.

Overall, speeds up compilation on a very large input from ~173 seconds
to ~7 seconds.
@cfallin cfallin mentioned this pull request Jul 24, 2026
@cfallin
cfallin requested a review from fitzgen July 24, 2026 21:49

@fitzgen fitzgen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo nitpicks below.

Seems like this crate would benefit from pulling in cranelift_entity in general, but I understand that is a larger change.

Comment thread src/backend/bitset.rs
Comment thread src/backend/cross_block_ids.rs Outdated
@cfallin
cfallin force-pushed the optimize-localify branch from a7be0c9 to e338fca Compare July 27, 2026 23:15
@cfallin
cfallin merged commit a21c86f into main Jul 27, 2026
3 checks passed
@cfallin
cfallin deleted the optimize-localify branch July 27, 2026 23:21
cfallin added a commit that referenced this pull request Jul 27, 2026
Includes #20 (optimizations to localify), #19 (use FxHashMap/FxHashSet
everywhere), and #18 (a treeifier soundness fix).
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.

2 participants