------- Comment #13 from rakdver at atrey dot karlin dot mff dot cuni dot cz  
2007-03-26 23:05 -------
Subject: Re:  [4.2/4.3 Regression] rtl loop invariant is broken

> Zdenek, what is the size heuristic for anyway?  For powerpc, the current
> heuristic tells the compiler not to move any simple moves:
> 
> 1) An invariant with a gain of 0 will not be moved.
> 2) gain = comp_cost - size_cost
> 3) comp_cost of a simple move is 4
> 4) all powerpc instructions have a size_cost of 4
> 
> (At least, the insns that map to a single machine insns have a size_cost of 
> 4.)

size_cost and global_cost_for_size are somewhat missnamed.  The purpose
of global_cost_for_size is to estimate the effect of register pressure,
and it currently works this way:

1) if the number of used registers is significantly smaller than the
   number of available registers, then the cost for each newly used
   register is target_small_cost (which probably turns out to be 4 on
   ppc)
2) if the number of used registers approaches the number of available
   registers, the cost for a newly used register increases more
   significantly (by target_pres_cost and later by target_spill_cost).

The purpose of 1) should have been to prevent optimizations that do not
gain anything and increase register pressure, but apparently this does
not work quite well.  Two possible solutions are decreasing
target_small_cost (maybe setting it fixed to one), or even removing the
penalty for increasing number of used registers in the case 1)
completely.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31360

Reply via email to