MachineCSE ignores COPY

Hello,

I see that MachienCSE ignores COPY instructions

bool MachineCSE::isCSECandidate(MachineInstr *MI) {

// Ignore copies.
if (MI->isCopyLike())
return false;

Are there any correctness concerns?

Thanks,
Vivek

Hi Vivek,

My guess is because copies are transient, so we expect them to disappear anyway.

Maybe it has to do as well with the fact that chances are the are dealing with physical reg copies, e.g., used for ABI.

Cheers,
-Quentin

Hi Vivek,

My guess is because copies are transient, so we expect them to disappear anyway.

That may prevent CSE in certain cases.

Maybe it has to do as well with the fact that chances are the are dealing with physical reg copies, e.g., used for ABI.

If an instruction has any physical register shouldn’t that will be handled in hasLivePhysRegDefUses() and such instruction will not be CSE.

-Vivek