Skip to content

Use sets instead of hashamps for the spillmaps (attempt #2)#304

Merged
ltratt merged 1 commit intoykjit:mainfrom
vext01:spillsets
Feb 2, 2026
Merged

Use sets instead of hashamps for the spillmaps (attempt #2)#304
ltratt merged 1 commit intoykjit:mainfrom
vext01:spillsets

Conversation

@vext01
Copy link
Copy Markdown

@vext01 vext01 commented Feb 2, 2026

The spillmap analysis has been a consistent source of bugs, mostly (in my opinion) due to the choice of data structures.

This change moves from a hashmap-centric representation to a set-based one. This is much less error prone and easier to understand than our previous hashmap-based method. It's also more compact.

For example, before if we had:
{
rax -> {rbx, rcx},
rbx -> {rax, rcx},
rcx -> {rax, rbx},
r11 -> {rbp-16},
// no rbp-16 -> {r11} because hashmap keyed by register!
}

Now it is stored as:
[
{rax, rbx, rcx},
{r11, rbp-16}
]

This fixes some broken benchmarks in an upcoming optimisation branch I have locally.

@vext01 vext01 mentioned this pull request Feb 2, 2026
@ltratt
Copy link
Copy Markdown

ltratt commented Feb 2, 2026

At some points this PR says "should" but I don't know if that means "can if you want" or "absolutely must". Can we force push a change which clarifies what is meant (i.e. avoiding the most dangerous word in the English language :p).

The spillmap analysis has been a consistent source of bugs, mostly (in
my opinion) due to the choice of data structures.

This change moves from a hashmap-centric representation to a set-based
one. This is much less error prone and easier to understand than our
previous hashmap-based method. It's also more compact.

For example, before if we had:
{
    rax -> {rbx, rcx},
    rbx -> {rax, rcx},
    rcx -> {rax, rbx},
    r11 -> {rbp-16},
    // no `rbp-16 -> {r11}` because hashmap keyed by register!
}

Now it is stored as:
[
    {rax, rbx, rcx},
    {r11, rbp-16}
]

This fixes some broken benchmarks in an upcoming optimisation branch I
have locally.
@vext01
Copy link
Copy Markdown
Author

vext01 commented Feb 2, 2026

Force pushed. If it looks OK I'll re-sync the yk-side.

@ltratt ltratt added this pull request to the merge queue Feb 2, 2026
Merged via the queue into ykjit:main with commit da53548 Feb 2, 2026
2 checks 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.

2 participants