David Edelsohn wrote: 
> On Fri, Nov 20, 2009 at 10:05 AM, Ian Bolton <bol...@icerasemi.com>
> wrote:
> > From some simple experiments (see below), it appears as though GCC
> aims
> > to
> > create a lop-sided tree when there are constants involved (func1
> below),
> > but a balanced tree when there aren't (func2 below).
> >
> > Our assumption is that GCC likes having constants all near to each
> other
> > to
> > aid with tree-based optimisations, but I'm fairly sure that, when it
> > comes
> > to scheduling, it would be better to have a balanced tree, so sched
> has
> > more
> > choices about what to schedule next?
> 
> I think this would depend on the target architecture and instruction
> set: CISC vs RISC, many registers vs few registers, etc.  I do not
> believe that GCC intentionally is trying to optimize for either, but I
> do not think there is a single, right answer.
>
Regardless of the architecture, I can't see how an unbalanced tree would
ever be a good thing.  With a balanced tree, you can still choose to
process it in either direction (broad versus deep) - whichever is better
for your architecture - but, as far as I can see (bearing in mind that
I'm very new to GCC development!), a tall lop-sided tree gives few
scheduling options due to all the extra dependencies.  I guess I must
be missing something?

Regards,
Ian

Reply via email to