[PATCH] D20531: MachineCopyPropagation: remove some more copys when they are not needed

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 07:52:06 PDT 2016

jonpa added a comment.

Thanks for feedback and review Matthias and Jun!

I have done a little further investigation on this, and it seems that

- If MCP would trust the live-in lists, about 40% more COPYs would be removed, or ~2 COPYs per file.
- This patch is nowhere near that. It fixed my particular problem, but little more (only one change per every 15 files or so).

Matthias: at least in this case, the code seemed identical after regcoalescer, but it was some merging of live intervals by the GreedyRegAlloc that somehow kept the copy propagation from happening.

I see an effective Copy propagation pass as at least a first step towards a final solution, since

- Regalloc passes are complex and difficult to improve. RAGreedy gets rid of nearly all the COPYs, but not all. This last part might be tricky to get in place.
- By turning off such a CopyProp pass, it would be easy to get many test cases for improving regalloc copy propagation. Eventually, perhaps regalloc could do it all.
- Copy propagation is simple and standard on its own. Even one single copy in a tight loop could make a noticable difference. This makes it important for stability during development of other optimisations, so as to not get a regression because of this.

So instead of continuing with this current patch, I wonder if it wouldn't be even better to try to use the ReachingPhysDefs utility and try a more aggressive algorithm with global liveness analysis.

What are your thoughts on this?


More information about the llvm-commits mailing list