-
Notifications
You must be signed in to change notification settings - Fork 777
[Unhoisted] [Binary] [Might not fallthrough] load & store order affects the constant propagation in binaryOp #7489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Looks like we can't move the However, the (block $block (result i32)
..
(drop
(br_if $block
(value)
(condition)
)
)
(value)
)
=>
(block $block (result i32)
..
(drop
(condition)
)
(value)
) That is, when a block ends in a |
Thanks for guidance. I've tried to fix as you suggested. |
Given the following code:
wasm-opt (c528c7e) can deduce the condition of branch (in the second block) to true by
-all -O2
, but cannot by-all -O3
.Below is the optimized code by
-all -O3
:It appears that the constant 1 is "buried" within the blocks and should be hoisted out so it can be recognized by
i32.eqz
.This is similar to #7455 (where a constant value should be hoisted out in a binary operation). The same principle could be apply to unary operations. However, the key difference here is that these blocks here have names thus preventing them from being "fallthrough".
Here is the relevant code in
getImmediateFallthroughPtr
:binaryen/src/ir/properties.h
Lines 288 to 292 in 93c541d
What do you think? Is there any better way to resolve it?
The text was updated successfully, but these errors were encountered: