[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.
A style, and process suggestion.
These first patterns can be handled via the common idiom of reading the operands, and then swapping the operand values before the main transform if required.
This would stand along well as it's own change. This is the part which currently matches your change description anyways.