WebAssembly / WebAssembly/binaryen
Fold extend followed by operations that do not care about the extended bits
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 69
Description
E.g.
(i64.eqz
(i64.extend_i32_u
(i64.eqz
(local.get $0)
)
)
)
=->
(i64.ne
(local.get $0)
(i64.const 0)
)
Comparing to zero is the same with or without extending: if was zero, it'll remain so, and if it wasn't zero, it still won't be zero.
Found by the superoptimizer https://github.com/WebAssembly/binaryen/pull/4994 (for comparison to other findings: rule #1, benefit 140074).
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 the WAT transformation in this issue and compare it with the superoptimizer findings in Binaryen pull request #4994. Locate the optimizer rule and its regression tests for extending values before operations that do not depend on the extended bits. Done means the shown equivalent form is recognized and the relevant tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, wasm
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100