Skip to content

[MemoryPacking] Avoid duplicate split segment names - #9361

Open
tlively wants to merge 1 commit into
mainfrom
memory-packing-duplicate-segment-names
Open

tlively wants to merge 1 commit into
mainfrom
memory-packing-duplicate-segment-names

Conversation

@tlively

@tlively tlively commented Nov 7, 2026

Copy link
Copy Markdown
Member

When MemoryPacking::createSplitSegments splits a data segment into multiple non-zero ranges, ranges after the first were previously named <name>.<N> without checking whether a segment with that name already existed in the module (for example from an earlier run of --memory-packing or in the input module). This caused duplicate segment names in packed and triggered an assertion failure in Module::updateDataSegmentsMap(). Increment the suffix counter until a name not already present in the module is found.

When `MemoryPacking::createSplitSegments` splits a data segment into multiple non-zero ranges, ranges after the first were previously named `<name>.<N>` without checking whether a segment with that name already existed in the module (for example from an earlier run of `--memory-packing` or in the input module). This caused duplicate segment names in `packed` and triggered an assertion failure in `Module::updateDataSegmentsMap()`. Increment the suffix counter until a name not already present in the module is found.
@tlively
tlively requested a review from a team as a code owner November 7, 2026 01:38
@tlively
tlively requested review from brendandahl and removed request for a team November 7, 2026 01:39

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the MemoryPacking pass to prevent name collisions when splitting data segments. It modifies the createSplitSegments function to accept a Module pointer instead of a Builder reference, allowing it to use Names::getValidDataSegmentName to ensure unique segment names. A corresponding test case has been added to verify this behavior. I have no feedback to provide as there are no review comments.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant