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

Use True/False constants for cfg branching if known at compile time #131

Open
ss2165 opened this issue Jan 22, 2024 · 2 comments
Open

Use True/False constants for cfg branching if known at compile time #131

ss2165 opened this issue Jan 22, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ss2165
Copy link
Member

ss2165 commented Jan 22, 2024

avoid needless Tag(0, MakeTuple()) calls

@ss2165 ss2165 added the enhancement New feature or request label Jan 22, 2024
@mark-koch
Copy link
Collaborator

This Tag(0, MakeTuple()) is also needed if there is only a single successor. Do we also want to use a constant in that case?

If the True/False value of a branch is known at compile-time, I think an even better solution would be to just remove the unreachable branch. This should also make our program analysis a bit smarter

@ss2165
Copy link
Member Author

ss2165 commented Jan 24, 2024

This Tag(0, MakeTuple()) is also needed if there is only a single successor. Do we also want to use a constant in that case?

Yes

If the True/False value of a branch is known at compile-time, I think an even better solution would be to just remove the unreachable branch.

Perhaps, but any HUGR compiler should do that as a normalisation pass pretty early on

@mark-koch mark-koch added the good first issue Good for newcomers label Jun 17, 2024
@mark-koch mark-koch removed their assignment Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants