This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PING] Move costs, allocno costs, and per-register costs


Richard Sandiford wrote:
Hi Vlad,

Thanks for the message.

Vladimir Makarov <vmakarov@redhat.com> writes:
Richard Sandiford wrote:
http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00325.html
Fixes a problem with the costs of union classes.  Needed to fix
MIPS dspr2-MULT{,U}.c regressions.

Sorry, Richard. I missed that email. I had some problems with my email (an still messages for some time is lost).

You did a big job comparing so many targets. I know about the problem. Recently I tried to modify IRA (Chaitin-Briggs algorithm) to permit allocnos to be of union of cover classes. It could solve the problem you are trying to solve by using smaller cover classes. It also could solve one IRA drawback in comparison with the old RA. Memory-memory movements (like arr[i] = arr [j]) are implemented usually as two insns using a temporary register. The temporary register could be of two cover classes (e.g. general purpose or float regs).

Yes, this would solve the problem in the case I'm seeing, in that it would be natural to treat GR_REGS and ACC_REGS as separate cover classes. But would you get rid of the "preferred class" code at the same time? If not, I think the underlying problem would still be there.

Yes, it addressed that problem if cover classes are uniform. But as I wrote there are a lot of other serious problems with this approach of using several cover classes for allocnos. Therefore I am not going to submit this code (but may be continue work on this).
To put it another way: having a single cover class is a fairly important
characteristic of the new RA.  On the other hand, I don't think the
problem I'm fixing _is_ a fundamental characteristic.  It seems to me
that IRA is simply internally inconsistent in its handling of certain
costs.  The inconsistency isn't fundamental to the algorithm or the
implementation: it seems to be more unintentional than anything.

Specifically, one part of IRA says that if A and B have cost X,
A union B also has cost X.  But this deduction (which is borrowed
from the old RA, correctly IMO) isn't transmitted to the code that
sets ALLOCNO_COVER_CLASS_COST to the cost of A union B.

I am agree with this. Actually the code was taken from regclass.c but I changed it so many times that I lost the count of this. Your fresh look found the problem.

Anyway I tested the patch on some benchmarks on x86/x86_64. It looks ok (I found no difference in the results).

You can commit the patch to the trunk. It looks ok to me.

Thanks a lot for the patch! You did a big job checking so many targets.

In

http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00325.html

you wrote

 In summary, I think ira-costs.c:record_reg_classes should not add
 ira_may_move_out_cost and ira_memory_cost for unused output operands.
 I'd like to test that at some point, but I've got a lot on my plate
 and probably won't find time.  (An agreement in principle might
 add a bit of incentive though.)

I think it would be interesting to see the results. Another would be interesting code is to check dealing with equiv memory. The code quality is very sensitive to changes in ira-costs.c.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]