On Wed, May 4, 2011 at 09:19, Nathan Froyd <froy...@codesourcery.com> wrote: > On Wed, May 04, 2011 at 08:30:40AM -0400, 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"? > > If you ever want to do things beside compile the code--automated > refactoring, renaming, pretty-printing, etc.--fidelity to the source is > preferred.
I think we may be talking at different levels. It's my impression that Richard K. was referring to local transformations like "a - a" -> "0" once we are in the middle end. I agree that doing that transformation close to the FE is undesirable, but once we are in the middle end that should be fine. Diego.