[CodeGen] Use swapOperands in TargetInstrInfo::commuteInstructionImpl
Use MachineInstr::swapOperands to swap the commuted operands, instead of
copying the register, subregister and flags of each register operand
individually. This means that the default implementation can now commute
operands of any type, not just registers. A tied operand still cannot be
commuted with a non-register operand.
Since swapOperands preserves the order of use-def lists, commuting an
instruction and then commuting it back (as MachineCSE does) is now a
no-op. Previously it perturbed the use-def list order, which could
affect later heuristics, which explains the change in select-cc.ll.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>