Skip to content

[OptimizeInstructions] Keep bulk mem ops in JS - #9406

Open
tlively wants to merge 1 commit into
mainfrom
optimize-instructions-js-bulk-memory
Open

tlively wants to merge 1 commit into
mainfrom
optimize-instructions-js-bulk-memory

Conversation

@tlively

@tlively tlively commented Nov 19, 2026

Copy link
Copy Markdown
Member

When targeting JS (wasm2js -O), OptimizeInstructions runs after i64-to-i32-lowering and alignment-lowering. Lowering constant-size memory.copy and memory.fill operations larger than 1 byte emits align=1 (and i64 or v128) loads and stores that are no longer lowered, tripping the alignment assertion in Wasm2JSBuilder::visitStore. Skip lowering multi-byte memory.copy and memory.fill when PassOptions::targetJS is set so wasm2js lowers them to wasm2js_memory_copy and wasm2js_memory_fill, while continuing to fold 0-byte and 1-byte operations.

When targeting JS (wasm2js -O), OptimizeInstructions runs after i64-to-i32-lowering and alignment-lowering. Lowering constant-size memory.copy and memory.fill operations larger than 1 byte emits align=1 (and i64 or v128) loads and stores that are no longer lowered, tripping the alignment assertion in Wasm2JSBuilder::visitStore. Skip lowering multi-byte memory.copy and memory.fill when PassOptions::targetJS is set so wasm2js lowers them to wasm2js_memory_copy and wasm2js_memory_fill, while continuing to fold 0-byte and 1-byte operations.

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