[PATCH] D30751: [MachineCopyForwarding] Add new pass to do register COPY forwarding at end of register allocation.

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 16 15:51:17 PDT 2017


qcolombet added a comment.

> This change is useful primarily to increase scheduling flexibility and reducing the critical path, though it does also make some COPYs unnecessary leading to their removal. Handling just the former in the scheduler is a possibility, but it would have the drawback of not provide a benefit to OoO cores that don't do post-RA scheduling.

I may be wrong but I wouldn't expect OoO cores to be that affected by such change.

> As to your question of why we end up with this pattern, I looked at some cases where we end up removing COPYs and saw two main causes for this:



> 1. virtual registers are not getting coalesced before/during RA because there is a mismatch in register-class (e.g. the source reg class is a subset of the dest reg class).

That's strange as long as the register-class are a subset of one another, the coalescing should still be possible. If there is no intersection then the coalescing is not possible at all.
Could you share some test cases?

> 2. only a partial segment of a complex live range has a COPY that becomes dead. In terms of overall compiler complexity, I suspect that this pass could be extended a bit (to handle subreg COPYs for example) and make the current MachineCopyPropagation unnecessary.

If we could merge the MachineCopyPropagation logic in here, then that would be a non-brainer for the goodness of this approach.

Cheers,
-Quentin


https://reviews.llvm.org/D30751





More information about the llvm-commits mailing list