Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port Comballoc to work on CFG values #2163

Merged
merged 11 commits into from
Feb 12, 2024
Merged

Port Comballoc to work on CFG values #2163

merged 11 commits into from
Feb 12, 2024

Conversation

xclerc
Copy link
Contributor

@xclerc xclerc commented Dec 14, 2023

This pull request, as the title suggests,
is merely a port of the Comballoc
optimization pass to CFG values.

However, the code is significantly
different, taking advantage of the
representation of basic blocks and
the ability to change / insert
instructions quite easily.

Since this code has a lot of potential
in terms of miscompilation, we should
not merge it before further testing.

@xclerc xclerc changed the base branch from main to alloc-instr December 14, 2023 12:17
@xclerc xclerc marked this pull request as ready for review December 14, 2023 14:38
Copy link
Contributor

@gretay-js gretay-js left a comment

Choose a reason for hiding this comment

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

I am slightly concerned about modifying instruction description in place without chaning instruction ids. It is currently safe (e.g., liveness is not yet precomputed, we only replace Alloc with a pure instruction not introducing enew ffects), but may lead to tricky bugs due to e.g., caching based on instruction ids or instructions themselves. Do we do it in other places?

Possible future improvement: when allocations of different modes are interleaved within a block, they can be combined into just two allocations (one of each mode), for example: H1;L1;H2;L2 would be combined into H12;L12.

@xclerc xclerc force-pushed the alloc-instr branch 2 times, most recently from 9d14559 to b6c0c23 Compare January 12, 2024 13:36
Base automatically changed from alloc-instr to main January 12, 2024 13:50
@xclerc
Copy link
Contributor Author

xclerc commented Feb 7, 2024

I have tested the code a bit more, and
on the stdlib both pipelines do exactly
the same work. I will try with larger
code bases.

@xclerc
Copy link
Contributor Author

xclerc commented Feb 8, 2024

On the compiler code, both pipeline
combine the very same allocations.
On other code base, I have seen very
occasional cases where the CFG
pipeline combines more allocations
due to larger basic blocks.

@xclerc xclerc merged commit c22043e into main Feb 12, 2024
17 checks passed
@xclerc xclerc deleted the cfg-comballoc branch February 12, 2024 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants