After tailduplication, we have redundant copies. For example
bb.6.land.lhs.true.1: ; predecessors: %bb.4 successors: %bb.2(0x80000000); %bb.2(100.00%) renamable $x5 = LI8 0 B %bb.2 bb.2.cleanup16: ; predecessors: %bb.3, %bb.1, %bb.6 liveins: $x5 $x3 = COPY killed renamable $x5 BLR8 implicit $lr8, implicit $rm, implicit $x3
TailDuplication will duplicate the copy of $x5 and blr in bb.2 to the end of bb.6.
We can remove these copies in machine-cp if it's safe to, i.e.
$reg0 = OP ... ... <<< No uses of $reg0 and $reg1 $reg1 = COPY $reg0 <<< $reg0 is killed ... <RET>
will be transformed to
$reg1 = OP ... ... <RET>
Added check of non-trivial copy.