Refactor AtomicExpand::expandAtomicRMWToCmpXchg into a standalone function.