The IR layer has already been switched to support different source and destination alignments for memcpy and memmove. However, this information is currently being discarded during SelectionDAG construction.
This patch pulls the different alignments through SelectionDAG and target lowering. The main changes are:
- SelectionDAG::getMemcpy and SelectionDAG::getMemmove now take separate DstAlign and SrcAlign arguments.
- EmitTargetCodeForMemcpy and EmitTargetCodeForMemmove now take separate DstAlign and SrcAlign arguments.
- Call-sites of getMemcpy are adjusted: These are usually either handling of byval arguments, or va_copy. In both cases I'm using the same source and destination alignment.
- Reviewed definitions of getOptimalMemOpType to make sure they treat the DstAlign and SrcAlign arguments correctly. These arguments were already separate previously, but there was a guarantee that always SrcAlign >= DstAlign (or zero). This guarantee no longer exists, so some additional checks need to be added.
- Added a test that shows mixed use of movaps/movups on X86 after this change. Previously all instructions were movups in the test.