Skip to content

Do not copy function annotations when copying expressions#8512

Merged
tlively merged 1 commit into
mainfrom
inline-opt-bug
Mar 23, 2026
Merged

Do not copy function annotations when copying expressions#8512
tlively merged 1 commit into
mainfrom
inline-opt-bug

Conversation

@tlively

@tlively tlively commented Mar 23, 2026

Copy link
Copy Markdown
Member

When copying expressions from one function to another, we previously also copied the function-level annotations from the source function to the destination. This is not correct, and caused a bug where the @binaryen.removable.if.unused annotation was copied from an inlined function to its caller, resulting in side effects being dropped. Fix the problem by moving responsibility for copying function annotations from copyBetweenFunctions to copyFunctionWithoutAdd.

Fixes #8509.

When copying expressions from one function to another, we previously also copied the function-level annotations from the source function to the destination. This is not correct, and caused a bug where the @binaryen.removable.if.unused annotation was copied from an inlined function to its caller, resulting in side effects being dropped. Fix the problem by moving responsibility for copying function annotations from `copyBetweenFunctions to `copyFunctionWithoutAdd`.
@tlively tlively requested a review from kripken March 23, 2026 22:43
@tlively tlively requested a review from a team as a code owner March 23, 2026 22:43

@kripken kripken 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.

Yikes, good catch.

@tlively tlively enabled auto-merge (squash) March 23, 2026 22:57
@tlively tlively merged commit 58de22c into main Mar 23, 2026
16 checks passed
@tlively tlively deleted the inline-opt-bug branch March 23, 2026 23:21
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.

Optimization bug in wasm-opt

2 participants