This teaches the min/max idiom detector in ValueTracking to see through
casts such as SExt/ZExt/Trunc. SCEV can already do this, so we're bringing
non-SCEV analyses up to the same level.
The returned LHS/RHS will not match the type of the original SelectInst
any more, so a CastOp is returned too to inform the caller how to
convert to the SelectInst's type.
UIToFP/FPToSI are not yet handled - that would require this function to be able to return floating point min/max, which I intend to do in the future.
No in-tree users yet; this will be used by InstCombine in a followup and will be tested there.
Please clang-format this.