-
Notifications
You must be signed in to change notification settings - Fork 787
OptimizeInstruction: Optimize any boolean & (No overlap with boolean's LSB) ==> 0 #7505
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
Conversation
Co-authored-by: Alon Zakai <alonzakai@gmail.com>
This comment was marked as outdated.
This comment was marked as outdated.
Co-authored-by: Alon Zakai <alonzakai@gmail.com>
Co-authored-by: Alon Zakai <alonzakai@gmail.com>
Co-authored-by: Alon Zakai <alonzakai@gmail.com>
I've been fuzzing for 60 minutes; and it looks goods enough. |
Since the PR has been carefully reviewed many times and lots of time has been invested, we should not miss the opportunity to optimize. Could you please review the code when you have a moment? @kripken |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay.
Co-authored-by: Alon Zakai <alonzakai@gmail.com>
Co-authored-by: Alon Zakai <alonzakai@gmail.com>
Co-authored-by: Alon Zakai <alonzakai@gmail.com>
Co-authored-by: Alon Zakai <alonzakai@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The fuzzer found a problem here, (module
(type $0 (func))
(type $16 (func (param f64) (result f32)))
(memory $0 16 17)
(export "func_28" (func $24))
(export "func_80" (func $76))
(func $24 (type $0)
(local $1 i32)
(i32.store offset=22 align=2
(local.tee $1
(i32.const 1)
)
(i32.const 1)
)
(drop
(block (result i32)
(if
(i32.const 0)
(then
(nop)
)
(else
(i32.store16 offset=2 align=1
(i32.and
(local.get $1)
(i32.const 1)
)
(i32.load16_u offset=22
(i32.const 0)
)
)
(block
(unreachable)
(local.tee $1
(unreachable)
)
)
)
)
(i32.const 0)
)
)
)
(func $76 (type $16) (param $0 f64) (result f32)
(local $1 f32)
(local.set $1
(f32.load offset=4 align=2
(i32.const 0)
)
)
(local.get $1)
)
)
I haven't investigated yet. |
Turns out this just uncovered an existing bug, fix in #7623 |
I am glad to hear the PR by myself didn't bring new bug into opt and even uncovered an existing one. 👍 Update: I've understood the bug, and it's somewhat interesting. |
There are so many rules for
and
, but we still cannot optimize the following one:to zero.
Adding rule for
add
:any boolean & (No overlap with boolean's LSB) ==> 0
Fixes: #7481