-
Notifications
You must be signed in to change notification settings - Fork 780
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Alon Zakai <[email protected]>
After updating all you suggested, I've fuzzing for about 20 minutes; and all is well. |
using namespace Abstract; | ||
using namespace Match; | ||
|
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.
using namespace Abstract; | |
using namespace Match; |
I think the current version does not use Abstract or Match?
// Check left's max bits and right is constant. | ||
auto leftMaxBits = Bits::getMaxBits(left, this); | ||
uint64_t maskLeft; | ||
if (leftMaxBits == 64) { |
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.
This would be 32 for a 32-bit operation.
if (leftMaxBits == 64) { | |
if (leftMaxBits == left->type.getByteSize() * 8) { |
uint64_t maskLeft; | ||
if (leftMaxBits == 64) { | ||
// If we know nothing useful about the bits on the left, | ||
// we can not optimize. |
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.
// we can not optimize. | |
// we cannot optimize. |
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