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

Unused recursive functions aren't optimized away #1227

Open
ospencer opened this issue May 15, 2022 · 0 comments · May be fixed by #2232
Open

Unused recursive functions aren't optimized away #1227

ospencer opened this issue May 15, 2022 · 0 comments · May be fixed by #2232

Comments

@ospencer
Copy link
Member

Example:

for (let mut j = 0; j < 10; j += 1) {
  let rec foo = () => {
    print("never executed")
    foo()
  }
  void
}

foo is never called but the code to allocate the closure and the actual webassembly function are generated. The optimize_dead_assignments optimization doesn't consider that foo is recursive and counts the usage of foo inside the body of foo as a use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants