-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[InstCombine] Missed optimization for icmp ult <power-of-2> & mask check #54856
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
Labels
Comments
I am interested in working on this issue. I have started looking into a solution. |
I am still working on a solution. |
Apologies, I was not aware that pushes to my forked repository would cause notifications on this ticket. I am currently developing associated test cases for the solution. |
Phabricator differential: https://reviews.llvm.org/D125717 |
jmciver
added a commit
that referenced
this issue
Jun 9, 2023
Provide both positive and negative testing using scalar and vector values for issue #54856. Reviewed By: goldstein.w.n Differential Revision: https://reviews.llvm.org/D143044
jmciver
added a commit
that referenced
this issue
Jun 9, 2023
Add an instance combine optimization for expressions of the form: (%arg u< C1) & ((%arg & C2) != C2) -> %arg u< C2 Where C1 is a power-of-2 and C2 is a contiguous mask starting 1 bit below C1. This commit resolves GitHub missed-optimization issue #54856. Validation of scalar tests: - https://alive2.llvm.org/ce/z/JfKjiU - https://alive2.llvm.org/ce/z/AruHY_ - https://alive2.llvm.org/ce/z/JAiR6t - https://alive2.llvm.org/ce/z/S2X2e5 - https://alive2.llvm.org/ce/z/4cycdE - https://alive2.llvm.org/ce/z/NcDiLP Validation of vector tests: - https://alive2.llvm.org/ce/z/ABY6tE - https://alive2.llvm.org/ce/z/BTJi3s - https://alive2.llvm.org/ce/z/3BKWpu - https://alive2.llvm.org/ce/z/RrAbkj - https://alive2.llvm.org/ce/z/nM6fsN Reviewed By: goldstein.w.n Differential Revision: https://reviews.llvm.org/D125717
Fixed in 1001f90 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is equivalent to:
where C1 is a power of 2, and C2 is a contiguous mask of bits starting 1 bit "below" C1.
For example:
This is already optimized if C2 is also a power of 2, but not if it has more than one set bit: https://godbolt.org/z/3a6WbKabr
Alive2 proof: https://alive2.llvm.org/ce/z/3Se4bm
The text was updated successfully, but these errors were encountered: