-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Combine and-mask+icmp eq -> icmp ule when mask was all-ones in low bits #37471
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
assigned to @LebedevRI |
|
This seems less likely, but there's always some kind of symmetrical pattern if you solve the problem generally: Name: range using high bits ? |
Heh, yes, i was planning on handling more patterns. The patterns with high bit mask will be similar, but not everything at once.. |
Not sure if we wanted this bug to cover all of the predicates, but let me add the example from D49179 using signed compares, so we don't forget it: Pre: isPowerOf2(C1+1) |
Ok, finished up the rest of unsigned predicates (for when mask is (-1 >> y)). https://rise4fun.com/Alive/I3O <- following 4 folds are possible for signed predicates. |
Done, too. In this case with signed predicates, we had to explicitly ignore The part (-1 << y) is TODO. Also, i wonder if we can/should do anything about |
This pattern with low-bit-mask was fixed via numerous commits. I've filed llvm/llvm-bugzilla-archive#38791 to track the opposite pattern. |
mentioned in issue llvm/llvm-bugzilla-archive#38791 |
Extended Description
https://rise4fun.com/Alive/W2u
https://godbolt.org/g/sCX9A6
This pattern will be produced by Implicit Integer Trucation sanitizer,
(https://reviews.llvm.org/D48958)
in unsigned case, therefore it is probably a good idea to improve it.
The text was updated successfully, but these errors were encountered: