Is there any pass existing in llvm which does machine copy propogation ?

Hi All,

I was looking into MachineCopyPropagationPass.ccp file in llvm, which in first look, looks likes to me doing only redundant copy elimination in same basic block.

I am interested in any pass which is doing copy propogation across the basic block in a function.

Let me know if any such pass exist ?

Thanks,

Deepali

Hexagon has RDFCopy.cpp that does that. It uses RDF framework that is currently under lib/Target/Hexagon, but is meant to be target-independent. See https://reviews.llvm.org/D29295.

What target are you interested in?

-Krzysztof

FWIW, there is also this proposed change

https://reviews.llvm.org/D30751 [MachineCopyPropagation] Extend pass to do COPY source forwarding

which enhances the MachineCopyPropagation pass to forward copied registers, though it still only operates at the block level.

It might be possible to extend this pass to work non-locally to some degree, but that should probably be evaluated against replacing it with RDFCopy once that pass is confirmed to work for all targets.

Thanks Krzysztof for the quick response.
I looking for x86 target.

Thanks,
-Deepali

At the moment X86 does not have a register unit for the upper part of EAX (not covered by AX), which makes AX and EAX have the same set of register units. This leads to incorrect results with RDF because writing to AX preserves the upper part of EAX, and this currently cannot be represented. This is somewhat of a known limitation.

Adding cc:Quentin: maybe he'll say what he thinks about adding that unit.

-Krzysztof