[PATCH] D41463: [CodeGen] Add a new pass to sink Copy instructions after RA

Jun Bum Lim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 13:11:28 PST 2018


junbuml added a comment.



> Is there anything preventing us to sink this even deeper than "one of the successors"? I think we should go further with this instead of special casing this particular issue.

As long as there is no the register dependency, we can continue sinking a COPY deeply. I believe sinkcopy5() in post-ra-machine-sink.mir shows this case.

> If we end up doing that, I think this pass should sink more than just COPYs. Is going further with this and having a generic Post-RA Sink pass what you're planning to do?
>  I wonder if we could improve MachineSink to be scheduled both pre and post RA.
>  If that's not suitable, should we build some kind of infrastructure where we can merge both pre and post RA Sink passes and re-use the algorithms while only changing the constraints?
>  I'm just throwing ideas out here, since this feels a little bit special cased to the shrink-wrapping issue, while it could (and from what I understand, it already does) catch some even more interesting opportunities.

I believe we can make this as a generic Post-RA Sink pass, but I didn't see any other motivation cases other than sinking COPYs for now.  Considering the current scope of this post-ra sink, I thought separating the pre/post-ra make code much simpler. If there are good enough motivation cases which require the post-ra sink pass to do the pretty much the same jobs done in pre-ra, I will be happy to extend it in a way that you mention here.

Thanks Francis for reviewing and testing this. I will fix your other comments soon.


https://reviews.llvm.org/D41463





More information about the llvm-commits mailing list