You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kmeakin
changed the title
[InstCombine] Missing fold for x == y in when x > y + 1 assumed
[InstCombine] Missing fold for x == y when x > y + 1 assumed
Mar 14, 2023
This happens as x >= y + 1 is equivalent to x > y . Thus the latter cmp can be folded naturely.
But x > y + 1 is not the case and y+1 is not captured by AssumptionCache
On this. It seems that simplifyICmpWithDominatingAssume is not capturing that case. Whilst a possible solution for this could be in ConstraintElimination, I'm gradually convincing myself the right place to fix this should be in ValueTracking::isImpliedCondICmps. Indeed, when the predicate of the two comparisons is the same as here below:
Closing this as it should be solved by this (Godbolt: https://godbolt.org/z/3ej4sxqaa), feel free to reopen should a similar issue arise (signed comparisons still to be handled).
x == y
is correctly folded tofalse
whenx > y
is assumed, or whenx >= y + 1
is assumed, but not whenx > y + 1
is assumed:godbolt
alive proof
The text was updated successfully, but these errors were encountered: