Hi,

On Wed, 4 May 2011, Richard Kenner wrote:

> > There are pros and cons about early optimization, actually.
> > Generating extremely optimized IL very early can actually tie up
> > subsequent passes.  For instance, loop unrolling and vectorization.
> > There are others in the literature.
> 
> Sure, in the sorts of examples you mention where there's a level of
> "globality" to it.  But I don't see it in the types of things that
> fold does.  How could it ever be better to leave "a - a" in the tree
> instead of "0"?

The former is not a constant expression in the C sense, hence folding it 
early disables required diagnostics; that's what Joseph means when he says 
that the frontends should fold only exactly those things that the language 
standard requires, implying not a general catch-all folder.  After the 
frontend is ready with a construct we can do all kinds of foldings as 
early as we like.


Ciao,
Michael.

Reply via email to