WebAssembly / WebAssembly/binaryen
Optimize comparisons of adjusted values
Open
@kripken is already working on this.
Since Sep 9, 2022.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 69
Description
E.g.
(i32.gt_u
(i32.shr_u
(local.get $0)
(i32.const 1)
)
(i32.const 100)
)
=->
(i32.gt_u
(local.get $0)
(i32.const 201)
)
Instead of dividing by 2 and then comparing, we can compare the original value.
More variations: add a constant, or both add and multiply/divide.
Found by the superoptimizer https://github.com/WebAssembly/binaryen/pull/4994 (for comparison to other findings: rule #8, benefit 30492).
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.
Assessment
This issue has not been assessed yet.