[llvm-commits] [patch] Improve register coalescing

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Thu Jun 30 14:36:53 PDT 2011


An updated copy is attached.

> Would it be possible to do more complete value-based checking? For
> example, you don't handle this:
>
> X = Y A = X B = Y

but it doesn't handle this, we would have to coalesce X and Y first 
(which might fail).

The real solution I think would be to turn the coalescing algorithm
upside down: instead of trying to merge registers one pair at a time,
start by assuming that every copy related register can be merged and
try to show it cannot.

In the above example, A, B, X, Y would be be in one set initially.
If we then show that X and Y cannot merge, we would have the sets
{A, B, X} and {A, B, Y}. If no further conflicts exist, we can choose
to merge A, B and X or A, B and Y.

An intermediate option is to look for copy chains. From

A = X
B = Y

we follow the definitions of X and Y until we find a non copy. It
would work on the above example, but fail in

BB1:
X = B
Y = A

BB2:
A = X
B = Y

A and B can be merged if X and Y can be merged and X and Y can be
merge if A and B can be merged.

> Thanks for working on this!

My pleasure :-)

> /jakob

Cheers,
Rafael
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: PR10096.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110630/00856d60/attachment.ksh>


More information about the llvm-commits mailing list