[llvm] [MachineCopyPropagation] Detect and fix suboptimal instruction order to enable optimizations (PR #98087)

Gábor Spaits via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 00:56:42 PDT 2024


spaits wrote:

@qcolombet Thank you for your response.

I put this "feature" here because it relies on the already implemented functionality of the pass. This functionality is the recognition of possible optimization in the backward propagation phase. I have just implemented a dependency representation and handling mechanism.

I am open to move this logic to elsewhere but then the full functionality of backward propagation must be also copied there, to recognize the cases when this moving is needed. (Except the register changing and deleting of redundant instructions.)

I was also thinking about if it is a good thing to move around instruction in MCP. My justification was that in this pass we already rename registers and delete instructions. These moves are only happening to enable that. So there can not be any case when the resulting MIR coming out of MCP just has instructions in a different order, moved around. When moving happens then also renaming and deletion will happen.

If there will be others that also think that this logic should be moved to  postRA scheduling, then I will move the dependency handling logic and also do some backward propagation like thing there to identify the cases that needs instruction moving.

https://github.com/llvm/llvm-project/pull/98087


More information about the llvm-commits mailing list