WebAssembly / WebAssembly/binaryen
wasm-opt: Optimize out store of load with traps-never-happen
Open
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 69
Description
Such WebAssembly code snippet will not be optimized by wasm-opt
(local $var i32)
...
local.tee $var
local.get $var
i32.load
i32.store
However, this equals
*var = *var
which is safe to remove.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with wasm-opt and reproduce the provided local.tee/local.get, i32.load, and i32.store pattern under the traps-never-happen assumption. Trace the optimization behavior for this sequence and add a regression check; done means wasm-opt removes the redundant store while preserving the intended result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100