[DAGCombine] Generalize foldSelectCCToShiftAnd
There are many equivalent ways to express the pattern `select_cc setlt
X, 0, A, 0". In this PR we extend the code in foldSelectCCToShiftAnd
to work on all such patterns.
By the time we call foldSelectCCToShiftAnd, the non-strict integer
inequalities must have been canonicalized to strict ones. But we can't
expect that the zero constant can only appear as the "false" argument of
the select. In this patch we extend foldSelectCCToShiftAnd to handle
these "inverted" cases.
I thought about doing this reversal all the way up in SimplifySelectCC. This may enable other transformations that previously assumed the canonicalized form. For example:
I haven't tried it yet, but do you think this is worth exploring?