[wasm-split] Remove unused module elements#8813
Merged
Merged
Conversation
We currently just leave unused module items in the primary module, except for globals (WebAssembly#8505). This removes other unused module items too, because it is simpler for upcoming PRs. We currently pin all segments in the primary module, but future PRs can change that, in which case segments' usage can be dependent on tables, in which case unused tables can become tricky as in the case of globals. This PR just removes all unused module items for simplicity. This doesn't mean this runs a comprehensive fixed-point analysis like RemoveUnusedModuleElements pass; it just drops elements that are never referenced anywhere in any modules when exporting them. Update some tests so that tables are "used" in not droped.
tlively
reviewed
Jun 8, 2026
tlively
left a comment
Member
There was a problem hiding this comment.
Can we add a positive test showing the unused items being removed as well?
Member
Author
|
Done: d42a9c1 |
tlively
approved these changes
Jun 8, 2026
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.
We currently just leave unused module items in the primary module, except for globals (#8505). This removes other unused module items too, because it is simpler for upcoming PRs.
We currently pin all segments in the primary module, but future PRs can change that, in which case segments' usage can be dependent on tables, in which case unused tables can become tricky as in the case of globals. This PR just removes all unused module items for simplicity. This doesn't mean this runs a comprehensive fixed-point analysis like RemoveUnusedModuleElements pass; it just drops elements that are never referenced anywhere in any modules when exporting them.
Updates some tests so that tables are "used" in not droped.