Skip to content

Introduce tagging and not while going down on boolean switch #409

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

Open
wants to merge 3 commits into
base: flambda2.0-stable
Choose a base branch
from

Conversation

chambart
Copy link

To avoid the problem with variables created while going up, this creates the required tagging and boolean_not operations while going down.

It looks for the presence of those variables in the CSE env, and checks if the scrutinee is a constant.
If they are available, the variables are passed to the rebuild. Otherwise a lets are introduced around the switch and simplify is called on it. This means that simplify_switch can be entered up to 3 times for a given switch. I don't know if there is a better solution. If there is a bug in the CSE or something around that, it might turn into an infinite loop.

I might have made some mistakes around operation counting: I didn't record any 'introduced operation'. Should I do that ? It seems like it might be required maybe ?

This is not required as is, it is possible for data_flow to do without this patch, but this feels cleaner than the other version.

@chambart chambart force-pushed the boolean_switch_while_going_down branch from 40d8fa7 to 78773cf Compare April 20, 2021 15:35
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.

1 participant