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

Remove any assumptions in IR about the 'entry' block. #4349

Open
otrho opened this issue Mar 27, 2023 · 0 comments
Open

Remove any assumptions in IR about the 'entry' block. #4349

otrho opened this issue Mar 27, 2023 · 0 comments
Labels
compiler: ir IRgen and sway-ir including optimization passes enhancement New feature or request

Comments

@otrho
Copy link
Contributor

otrho commented Mar 27, 2023

When we crate a new Function in IR it automatically gets a single entry block where execution begins and where new instructions will initially be added.

While implementing the constdemotion pass in #4336 I had it creating a block before the entry block. This meant that the block called 'entry' might not actually be the first block, and in turn I found some parts of the compiler which made this assumption.

We should make sure we don't make any assumptions about the name of the entry block, or any block really, and instead use an explicit API to fetch the entry block as the first block (not the block called entry).

We could also consider whether it's good design to create the implicit entry block upon Function creation or not.

@otrho otrho added enhancement New feature or request compiler: ir IRgen and sway-ir including optimization passes labels Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: ir IRgen and sway-ir including optimization passes enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant