This extends the transform added with D81756 to handle div/rem opcodes. For example:
https://alive2.llvm.org/ce/z/cX6za6
This replicates part of what CVP already does, but the motivating example from issue #57472, demonstrates a phase ordering problem - we convert branches to select before CVP runs and miss the transform.
I didn't find an explanation for skipping a constant operand in the existing zext code (ie, sext i8 42 -> zext i8 42 is valid, but we skip it). So that clause is not included for this transform, but there is a test diff for that pattern in case it should be bypassed.
I'd split this into a refactoring NFC patch that adds the helper function, then add the code for sdiv/srem cases if approved. I can also add ashr->lshr as a follow-up.
Should we add a 'TODO' here just like what we do for @sdiv_nonneg0_nonnegconst1 ?