Skip to content

[wasm-split] Remove unused module elements#8813

Merged
aheejin merged 3 commits into
WebAssembly:mainfrom
aheejin:wasm_split_remove_unused
Jun 8, 2026
Merged

[wasm-split] Remove unused module elements#8813
aheejin merged 3 commits into
WebAssembly:mainfrom
aheejin:wasm_split_remove_unused

Conversation

@aheejin

@aheejin aheejin commented Jun 8, 2026

Copy link
Copy Markdown
Member

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.

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.
@aheejin aheejin requested a review from tlively June 8, 2026 19:32
@aheejin aheejin requested a review from a team as a code owner June 8, 2026 19:32

@tlively tlively left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a positive test showing the unused items being removed as well?

@aheejin

aheejin commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

Done: d42a9c1

@aheejin aheejin merged commit dfebc6a into WebAssembly:main Jun 8, 2026
16 checks passed
@aheejin aheejin deleted the wasm_split_remove_unused branch June 8, 2026 21:41
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.

2 participants