Add option to remove empty function exports - #9078
Open
GtechGovind wants to merge 2 commits into
Open
Conversation
GtechGovind
marked this pull request as ready for review
September 5, 2026 07:10
GtechGovind
requested review from
stevenfontanella
and removed request for
a team
September 5, 2026 07:10
Member
|
It is! Firefly Zero is still a thing and thriving. Thank you :) |
kripken
reviewed
Sep 9, 2026
| } | ||
| return false; | ||
| }); | ||
| } |
Member
There was a problem hiding this comment.
It looks like this doesn't really integrate with the pass. How about adding a new pass, similar to e.g. RemoveStart or RemoveExports? We can call it RemoveEmptyFunctionExports.
kripken
reviewed
Sep 10, 2026
|
|
||
| // | ||
| // Remove exports of empty defined functions, for runtimes that treat missing | ||
| // exports as optional. Function bodies are left intact; run |
Member
There was a problem hiding this comment.
Suggested change
| // exports as optional. Function bodies are left intact; run | |
| // exports as optional. The functions themselves are left intact; run |
This is clearer, I think. A function has a body and also a definition, parameters, etc. - all of that remains, not just the body.
kripken
reviewed
Sep 10, 2026
| ;; RUN: wasm-opt %s --all-features --remove-unused-module-elements -S -o - | filecheck %s --check-prefix=DEFAULT | ||
| ;; RUN: wasm-opt %s --all-features --remove-empty-function-exports -S -o - | filecheck %s --check-prefix=REMOVE | ||
| ;; RUN: wasm-opt %s --all-features --remove-empty-function-exports --remove-empty-function-exports -S -o - | filecheck %s --check-prefix=REMOVE | ||
| ;; RUN: wasm-opt %s --all-features --remove-empty-function-exports --remove-unused-module-elements -S -o - | filecheck %s --check-prefix=DCE |
Member
There was a problem hiding this comment.
This seems excessive to me. -remove-unused-module-elements is tested heavily already. Please only test the new pass here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6506.
Summary
remove-unused-module-elements-consider-empty-exports-unusedpass argumentTesting
wasm-optsuite