This patch contains following enhancements to SrcRegMap and DstRegMap:
1 In findOnlyInterestingUse not only check if the Reg is two address usage, but also check after commutation can it be two address usage. 2 If a physical register is clobbered, remove SrcRegMap entries that are mapped to it. 3 In processTiedPairs, when create a new COPY instruction, add a SrcRegMap entry only when the COPY instruction is coalescable. (The COPY src is killed)
With these enhancements isProfitableToCommute can do better commute decision, and finally more register copies are removed.
Use TargetInstrInfo::CommuteAnyOperandIndex so this doesn't look like a member access?