[PATCH] Improve lim for pulling loads from global variable out of loops

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Fri Nov 12 19:09:00 GMT 2004


Hello,

> > > > if (!is_gimple_reg (rhs))
> > > >    cost += 20;
> > > 
> > > This would cause us to count any operation except for simple reg = reg
> > > copy as expensive, which definitely is not what is wanted.
> > > 
> > Huh?  Absolutely not.  Read the predicate again.  If the RHS is a
> > register, we don't increase the cost.
> > 
> Never mind.  I mis-read your paragraph, sorry.
> 
> Yes, this would make reg = CST, expensive.

more importantly, for example

reg = reg + reg

would be considered expensive.

> So, if you only want to make
> memory stores and loads expensive, you can ask it directly with:
> 
>   if (NUM_VUSES (VUSE_OPS (ann)) > 0
>       || NUM_V_MAY_DEFS (V_MAY_DEF_OPS (ann)) > 0
>       || NUM_V_MUST_DEFS (V_MUST_DEF_OPS (ann)) > 0))
>     cost += 20;
> 
> (this whole expression should probably be implemented into a predicate).

This seems like a good idea.  I will send the patch once it passes
testing.

Zdenek



More information about the Gcc-patches mailing list