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

Move evaluation of the array_len builtin from monomorphization to SSA/acir-gen #1736

Closed
jfecher opened this issue Jun 16, 2023 · 1 comment
Closed
Assignees
Labels
enhancement New feature or request refactor ssa

Comments

@jfecher
Copy link
Contributor

jfecher commented Jun 16, 2023

Problem

The monomorphization pass currently contains a check to evaluate the array_len builtin function. This is somewhat odd as it is the only thing the pass will attempt to evaluate. This has caused bugs in the past (#562, #1354), primarily from functions like to_be_bytes that return an array of unknown length (they should be returning slices instead).

Happy Case

We could make array_len a builtin instead and leave the function call in for ssa to optimize if the type is known. This would also more easily allow it to be used for slice types with unknown lengths when they are added. Any calls to array_len remaining in acir_gen can be easily evaluated there as well.

Alternatives Considered

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@jfecher
Copy link
Contributor Author

jfecher commented Jul 31, 2023

Completed in #2070

@jfecher jfecher closed this as completed Jul 31, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor ssa
Projects
Archived in project
Development

No branches or pull requests

2 participants