This is a generalization of a suggestion from issue #60799 that allows removing a redundant guard of an input value via icmp+select. It should also solve issue #60801.
This only comes into play for a select with an equality condition where we are trying to substitute a constant into the false arm of a select. (A 'true' select arm substitution allows "refinement", so it is not on this code path.)
The constant must be the same in the compare and the select, and it must be a "binop absorber" (X op C = C). That query currently includes 'or', 'and', and 'mul', so there are tests for all of those opcodes.
We then use "impliesPoison" on the false arm binop and the original "Op" to be replaced to ensure that the select is not actually blocking poison from leaking. That could be potentially expensive as we recursively test each operand, but it is currently limited to a depth of 2. That's enough to catch our motivating cases, but probably nothing more complicated (although that seems unlikely).
I don't know how to generalize a proof for Alive2 for this, but here's a positive and negative test example to help illustrate the subtle logic differences of poison propagation:
https://alive2.llvm.org/ce/z/Sz5K-c