-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Missed optimization in InstCombine: replace usub with or #56926
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
usub.with.overflow where only the overflow result is used should just be replaced with an icmp. |
This make sense, although I think this will move us to this bug where subtraction is changed to comparison and in the end the codegen is not able to generate optional |
…the math value https://alive2.llvm.org/ce/z/UE48FH This is part of solving issue #56926.
926e731 - both examples should now canonicalize to the same IR: define i1 @src(i64 %0, i64 %1, i1 %2) {
%4 = or i64 %1, %0
%5 = icmp eq i64 %4, 0
%6 = and i1 %5, %2
ret i1 %6
}
We should deal with x86 codegen problems independently of that. Repurpose this bug for that or open a new one? |
I think this is very good solution for the particular problem. I will play with this once Compiler Explorer is updated. |
When you have usub instructions chained by overflow (borrow) flag (e.g. for big integer "less than") you can replace all except one usubs with or.
https://alive2.llvm.org/ce/z/yhrBrK
The text was updated successfully, but these errors were encountered: