Cannot optimize complex ge_u 0 out
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- wasm
- Domain
- compilers
Research direction
Start with the supplied wasm-opt e6d02fa1 example and compare the -all -O2 and -all -O3 results. Read issue #7455 and its implementation or tests for complex lt_u 0, then verify that the equivalent complex ge_u 0 pattern is reduced to one under -O3.
Written by the indexing model from the issue text.
Description
Given the following code:
(module
(type $0 (func))
(type $1 (func (param i32 i32) (result i32)))
(type $2 (func (result i32)))
(type $3 (func (param i32) (result i32)))
(import "External" "external_function" (func $external_function (type $0)))
(func $_start (type $3) (param $0 i32) (result i32)
(local $1 i32) (local $2 i32)
i32.const 0
i32.load
local.set $2
local.get $1
i32.const 0
call $foo
local.set $1
local.get $1
local.get $2
i32.le_u
if (result i32)
i32.const 0
else
call $external_function
i32.const 1
end)
(func $foo (type $1) (param $0 i32) (param $1 i32) (result i32)
i32.const 0
i32.const 0
i32.store
i32.const 0)
(memory $0 258 258)
(export "_start" (func $_start)))
wasm-opt (e6d02fa1) -all -O3 cannot optimize the
(i32.ge_u
(i32.load
(i32.const 0)
)
(block (result i32)
(i32.store
(i32.const 0)
(i32.const 0)
)
(i32.const 0)
)
)
to one (while -all -O2 can)
It is already discussed in #7455 (complex lt_u 0). in contrast, this is complex ge_u 0. So fix this the way as before.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 70
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 2/5 Half a day Newbie friendliness 76/100
WebAssembly/binaryen#9018 · 3 comments ·
-
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 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
WebAssembly/binaryen#9086 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
WebAssembly/binaryen#9038 · 5 comments ·
All issues in WebAssembly/binaryen
Similar issues
-
compiler/runtime
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
objectionary/eo#8869 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
EricSpencer00/Resilient#4824 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
objectionary/jeo-maven-plugin#1758 ·
-
generics
Difficulty 2/5 1-3 hours Newbie friendliness 82/100