Redundant global read
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- wasm
- Domain
- compilers, performance
Research direction
Start by locating Binaryen's optimization pass that handles global.set and global.get, then inspect existing tests for global transformations. Add coverage for simple and complex values as shown in the issue, and consider the work done when the redundant read is removed while the examples retain their behavior.
Written by the indexing model from the issue text.
Description
In situations when global reads immediately after write we could avoid this read and use argument of global.set. For example this:
(module
(global $g (mut i32) (i32.const 0))
(func $test (param $0 i32) (result i32)
(global.set $g (local.get $0))
(global.get $g)
)
)
can be optimized as:
(module
(global $g (mut i32) (i32.const 0))
(func $test (param $0 i32) (result i32)
(global.set $g (local.get $0))
(local.get $0)
)
)
if arg is simple like local.get or i32.const
and something like this if arg more complex:
(module
(global $g (mut i32) (i32.const 0))
(func $test (param $0 i32) (result i32)
(global.set $g (local.tee $tmp (...complex expr...)))
(local.get $tmp)
)
)
- 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
-
internal.h中,漏掉了1个定义。 Open
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
oxc-project/oxc#26944 ·