I found the following pattern in the LLVM test suite + SPEC 93 times:
csel B, A, A
I see that in some places after MachineCSE runs, we end up with things like:
%5:gpr32 = CSELWr %1, %1, 12, implicit $nzcv
In this case, a COPY would be much better.
I added support for optimizeSelect in AArch64InstrInfo, which is called by the PeepholeOptimizer.