Skip to content

Add option to remove empty function exports - #9078

Merged
kripken merged 5 commits into
WebAssembly:mainfrom
GtechGovind:fix/remove-empty-exports
Sep 16, 2026
Merged

kripken merged 5 commits into
WebAssembly:mainfrom
GtechGovind:fix/remove-empty-exports

Conversation

@GtechGovind

Copy link
Copy Markdown
Contributor

Fixes #6506.

Summary

  • add an opt-in remove-unused-module-elements-consider-empty-exports-unused pass argument
  • remove exports of defined functions whose bodies are empty while preserving imported and non-empty exports
  • let normal reachability analysis retain empty functions that are still used internally

Testing

  • full CMake build
  • Binaryen lit suite: 984 passed, 6 unsupported
  • C++ unit suite: 420 passed
  • legacy wasm-opt suite
  • focused empty-export lit regression test

@GtechGovind
GtechGovind marked this pull request as ready for review September 5, 2026 07:10
@GtechGovind
GtechGovind requested a review from a team as a code owner September 5, 2026 07:10
@GtechGovind
GtechGovind requested review from stevenfontanella and removed request for a team September 5, 2026 07:10
@kripken

kripken commented Sep 8, 2026

Copy link
Copy Markdown
Member

@orsinium , this is for a request you made over 2 years ago in #6506. Is it still relevant for you?

@orsinium

orsinium commented Sep 9, 2026

Copy link
Copy Markdown

It is! Firefly Zero is still a thing and thriving. Thank you :)

Comment thread src/passes/RemoveUnusedModuleElements.cpp Outdated
Comment thread src/passes/RemoveEmptyFunctionExports.cpp Outdated
Comment thread test/lit/passes/remove-empty-function-exports.wat Outdated
Comment thread src/passes/pass.cpp Outdated
@stevenfontanella
stevenfontanella removed their request for review September 15, 2026 16:46
@kripken
kripken merged commit 1b198ae into WebAssembly:main Sep 16, 2026
16 checks passed
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.

How to remove no-op exported functions?

3 participants