Skip to content

Unused recursive functions aren't optimized away #1227

@ospencer

Description

@ospencer

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions