Some FP compares expand to a sequence ending with (xor X, 1) to invert the result. If
the consumer is a select_cc we can likely get rid of this xor by fixing
up the select_cc condition.
This patch combines (select_cc (xor X, 1), 0, setne, trueV, falseV) -
(select_cc X, 0, seteq, trueV, falseV) if we can prove X is 0/1.
We should absolutely document that this expects the condition to be an xleni with values corresponding to getBooleanContents. This should go where the opcode is defined in RISCVISelLowering.h though.
Given this seems to be the case, I think this optimization is correct (or as correct as my patch).