This is the mail archive of the gcc-patches@gcc.gnu.org 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: [ast-optimizer-branch] Goto/Break/Continue/Switch elimination


On Thu, 2 May 2002, Zack Weinberg wrote:

> On Thu, May 02, 2002 at 01:48:38PM +0100, Sebastian Pop wrote:
> > Hi,
> > 
> > The following patch and newfiles.tar.gz implements a goto, break and continue 
> > elimination pass on SIMPLE trees. It uses the double linked statement chain 
> > (it is really much more simpler to implement transformations on trees when we 
> > can access the previous statement, and the code becomes much more readable).
> 
> Maybe I'm missing the point, but why is this a desirable optimization?


Among other things, it makes optimizations and analyses *much* easier. Fer 
instance, you no longer have to worry about statements that explicitly alter control flow (IE 
jumps).

Normally, for something like SSAPRE, given:


if (a)
{
	goto blah;
}

, if we need to insert an evaluation of an expression in this block, we 
have to know to insert *before* the goto.
You can't just insert at the end of the block, without worrying about it, 
which ideally, is what you want to do.

With gotos, breaks, and continues gone, the above will never occur.
You can always just insert at the end of the block, without worrying about 
control altering statements.

> It looks like it massively increases code size, and I don't see why
> the result would be any faster.

Even if it wasn't faster, it would still be a win in terms of making it 
easier to write optimizations and analyses.


> 
> zw
> 


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