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

Add RewriteControlFlow phase. #907

Merged
merged 5 commits into from
Sep 25, 2024
Merged

Add RewriteControlFlow phase. #907

merged 5 commits into from
Sep 25, 2024

Conversation

maximebuyse
Copy link
Contributor

Closes #393

@maximebuyse
Copy link
Contributor Author

@W95Psp I refactored like we discussed using Ast_utils.collect_let_bindings to treat directly with a sequence of "statements". This is indeed simpler and seems to work well.

@maximebuyse maximebuyse requested a review from W95Psp September 25, 2024 06:55
Copy link
Collaborator

@W95Psp W95Psp left a comment

Choose a reason for hiding this comment

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

Looks great to me, thank you!
I have one small code remark, but also, as we discussed yesterday, this phase sometimes adds extra let _ = () in. Can you try to spot where those are produced and prevent it?
For an example see https://hax-playground.cryspen.com/#fstar/595d6dddc9/gist=9c4e9735d9e4055b3407c81bc4238e8f

@maximebuyse
Copy link
Contributor Author

Looks great to me, thank you! I have one small code remark, but also, as we discussed yesterday, this phase sometimes adds extra let _ = () in. Can you try to spot where those are produced and prevent it? For an example see https://hax-playground.cryspen.com/#fstar/595d6dddc9/gist=9c4e9735d9e4055b3407c81bc4238e8f

I fixed that. I noticed that in your example there is also a let _ = 3. Should we remove that as well?

@W95Psp
Copy link
Collaborator

W95Psp commented Sep 25, 2024

Yeah, the 3 is useless, and since all side effects are moved away, I would say such values will always be useless.
However, since the user typed it, I'm in favor of keeping it: in general I think it's a great thing to keep user inputs, even if the input make no much sense.
So let's keep that as it is!

Copy link
Collaborator

@W95Psp W95Psp left a comment

Choose a reason for hiding this comment

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

Thanks, I have one tiny tiny stupid remark (sorry for that 😅), and then let's merge it!

@W95Psp W95Psp added this pull request to the merge queue Sep 25, 2024
Merged via the queue into main with commit cc38130 Sep 25, 2024
13 checks passed
@W95Psp W95Psp deleted the rewrite-control-flow branch September 25, 2024 09:31
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.

Add a RewriteControlFlow phase (return/continue/break)
2 participants