[Proposal] Add getMaxSignBits for tracking sign values
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 28/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- wasm
- Domain
- compilers
Research direction
Start by locating the existing getMaxBits implementation and the optimizer paths for signed comparisons and arithmetic. Determine the intended getMaxSignBits behavior from the examples, then define the helper and its overflow-analysis uses; done means the proposed signed optimizations are supported without incorrect transformations.
Written by the indexing model from the issue text.
Description
With existing getMaxBits we could provide wide range of optimizations but getMaxBits completely blind for signed operations and values. This leaves a lot of places that could be relatively easily optimised. For example:
i32(x) - i32(y) < 0 -> x < y
If we know x - y never overflow (it required getMaxSignBits for signed comparison). Or more expressive example:
i32(x) * 400 / 100 -> x * 4
if we know getMaxSignBits(x) >= 9.
For example:
(i32(x) >> 9) * 400 / 100 -> (x >> 9) << 2
In general, getMaxSignBits is the building block for helpers that calculate the signed overflow for +, - and *
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 77
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.
More from WebAssembly/binaryen
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
WebAssembly/binaryen#9135 · 1 comment ·
-
Difficulty 2/5 Half a day Newbie friendliness 76/100
WebAssembly/binaryen#9018 · 3 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
WebAssembly/binaryen#9133 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
WebAssembly/binaryen#9123 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
WebAssembly/binaryen#9122 ·
All issues in WebAssembly/binaryen
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
objectionary/eo#8923 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Coarray integration tests carry no LABELS, so run_tests.py silently skips them under every backend Opencoarray
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
internal.h中,漏掉了1个定义。 Open
Difficulty 1/5 Under an hour Newbie friendliness 95/100