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

[ codegen ] get rid of artifacts introduced when optimizing IO #3376

Merged
merged 10 commits into from
Aug 26, 2024

Conversation

stefan-hoeck
Copy link
Contributor

Description

This fixes #3375 by adding two additional rules to constant folding.

@gallais
Copy link
Member

gallais commented Aug 23, 2024

Can we add a test case demonstrating it indeed fixes #3375?
In the test runner, you should be able to use something like

awk -v RS= '/\/\* Main.main/' build/exec/main

to extract just the code of the main function from the javascript file.

@stefan-hoeck
Copy link
Contributor Author

I added a test case using grep instead of awk. It checks the whole .js file for the patterns described in #3375 . None must be found. Funny enough, the new version no longer got rid of all the undefined cases. I therefore simplified the case where the variable term can be replaced.

@stefan-hoeck
Copy link
Contributor Author

stefan-hoeck commented Aug 23, 2024

I removed the first line checking for CLocal: It was redundant. In addition, I added example functions for the four different forms of reducable let expressions: Nested and non-nested, the scrutinee being reducable or not.

@gallais gallais merged commit c5f31c9 into idris-lang:main Aug 26, 2024
22 checks passed
@stefan-hoeck stefan-hoeck deleted the cfold_lazy branch August 26, 2024 10:40
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.

[ codegen ] Idris generates non-productive artifacts when optimizing IO
2 participants