-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[InstCombine] infinite loop with select + compare canonicalization #52684
Comments
Slightly reduced:
@spatel-gh Any recommendation for the best way to resolve this? |
Note: this is Sanjay, and I am @spatel-gh too, but I think all of my llvm work is credited to my @rotateright ID, so I'm posting from that. We should decide if that select transform still has enough value to keep it alive vs. adapting it into codegen. But as a fast fix, we can go with one more strategic exception (this patch solves the loop and doesn't change any existing tests - let me know if I should push it):
|
@rotateright I think it generally makes sense to exclude the pattern there (it's a hack, but a familiar hack...) but I don't really get where you are taking the |
Ah, yes you're correct. I was looking at the infinite loop example instead of the code for the fold. I'll create a couple of tests, so we know the bailout works more generally. |
Thanks for the quick fix! Much appreciated. |
The attached test case is causing instcombine to infinite loop. The two transformations that are going back and forth are:
InstCombineSelect.cpp:
and:
InstCombineCompares.cpp:
The select transformation is doing this:
It is flipping the compare so that the constant becomes the same as one of the
select operands.
The compare canonicalization then undoes this transformation, as it changes "ugt" back to ult". It looks like
one of these transformations should be prevented, but it is not immediately clear which way is "better".
The text was updated successfully, but these errors were encountered: