This is the mail archive of the 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: [PATCH] New code size estimate

On Mon, 28 Feb 2005, Steven Bosscher wrote:

> Ref:
> > 	* tree-inline.c (estimate_num_insns_1): Ignore stores to decls with
> > 	ignored flag set.
> Someone still has to explain why this makes sense.  All large
> expressions will now suddenly look really small, if I understand
> this change correctly.  For example, say you have,
> x = a + b + c + d + e + .... + z;
> then the equivalent GIMPLE will look something like,
> t2 = a + b;
> t3 = t2 + c;
> ...
> ...
> x = t25 + z;
> and all the "t[0-9]+" temporaries would result in real code being
> generated, but their assignments would be ignored if this patch is
> applied, because all temporaries would have DECL_IGNORED set on
> them.  Ignoring them would be not quite sane IMHO. Am I missing
> something here?

Yes, we count the cost of the addition.  I.e. the cost for

 x = a0 + a1 + a2 + ... + aN;

is the number of additions plus the cost of the store to x in
the new metric, while it is the number of additions plus all
stores (including those to the temporaries) in the old metric.
Usually those intermediate stores are for free.  What could
be changed is that we currently do not account for _uses_ of
real variables, i.e. the read from a0..aN is supposed to be
free, as is the use of constants.  That could be changed to
only make uses of DECL_IGNORED variables free - i.e. account
for a variable load at least once.  Note that we still walk
the sub-trees for stores to DECL_IGNORED variables, so if
there is an extra cost for the LHS or the RHS of the MODIFY_EXPR
we account for it.


Richard Guenther <richard dot guenther at uni-tuebingen dot de>

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