[PATCH] Allow the RegisterCoalescer to remove copies to reserved registers

hfinkel at anl.gov hfinkel at anl.gov
Wed Jan 14 15:05:25 PST 2015

In http://reviews.llvm.org/D6978#108843, @qcolombet wrote:

> Hi Hal,
> I am worry about the approach here.
>  With this approach, we are propagating constraints on the allocation problem that we cannot recover from. We cannot split physical register live-ranges. The bottom line is it may introduce more spilling or more expensive splitting.

Good point. I was thinking about my motivating use case, where the physical register involved was reserved. In this case, removing the vreg makes the allocation problem strictly easier. Perhaps we should restrict to the case of a reserved physical register?

At least for that case, I'd like to do this before register allocation.

When I looked at our regression tests for where this changed something, it seems to pick up this case as well (on x86, rbp is reserved in that test case; on ARM, sp is reserved).

> I would suggest instead to extend the copy propagation pass to handle such cases, since at that time the allocation has all been done. IIRC the copy propagation pass is top down, but we may be able to add a bottom up pass that would catch this.

I can certainly try that if you don't like my suggestion above.

Thanks again!

> What do you think?


> Cheers,

> -Quentin



More information about the llvm-commits mailing list