https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90174

--- Comment #9 from Feng Xue <fxue at os dot amperecomputing.com> ---
(In reply to Feng Xue from comment #5)
> >   I would say that top-down algorithm behaves better than bottom-up one.  I
> > implemented Callahan-Koblentz (bottom-up algorithm) in GCC about 10 years
> > ago and it behaved worse than the current one.  I think adding an additional
> Intuitively, it's better to give preference to regions with higher frequency
> to let them pick up registers earlier and with more freedom, which matches
> with bottom-up coloring strategy.
> 
> > pass over regions probably would solve the problem but it will complicate
> > already complicated RA (which is about 60K lines now). In any case I'll
> > think about this problem.
> > 
> >   The problem you are mentioning in this code is quite insignificant (one
> > memory access in the top most region).
> But it will be significant inside multi-level loop. Actually, the problem is
> exposed by a 8-level loop in a real Fortran application. 
> 
> >   
> >   I also checked the attachments.  What I see is GCC generates a better big
> > loop body (a loop with high register pressure).  GCC generated loop body has
> > 50 x86-64 insns with 22 memory accesses vs 56 with 26 memory access for 
> > LLVM.
> As far as how to spilling live range at loop boundary is concerned, gcc is
> not very efficient. To make loop body not be the focus, when we remove two
> live-range variables in original case, we can get same amount of memory
> accesses for gcc and llvm, both of which generates 9 register spills in loop
> body. I attached modified case and assembly files.

For the modified case, allocation of llvm and gcc remain nearly the same for
loop body, but as to 'lv0', llvm gets better spill/split result over gcc.

Reply via email to