[InstSimplify] Partially handle sel of min/max via select equivalence (#247103)
`(X != Y) ? X : max/min(X, Y) --> X` is already handled via select
equivalence. The `(X == Y) ? X : max/min(X, Y) --> max/min(X, Y)` case
needs a minor improvement to simplifyWithOpsReplaced, so that the X ->
max/min(X, X) replacement is not considered a derefinement (as long as
it has no poison-generating annotations).
This also fixes handling of poison-generating attributes, which are no
longer folded in InstSimplify and get dropped in InstCombine.
Note that the miscompile still exists in the remainder of the transform,
which will be fixed by https://github.com/llvm/llvm-project/pull/246815.
The motivation for this change is to avoid an InstSimplify leftover
there.