This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [ast-optimizer-branch] Goto/Break/Continue/Switch elimination
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: Zack Weinberg <zack at codesourcery dot com>
- Cc: Sebastian Pop <m1sp at csc dot liv dot ac dot uk>, <dnovillo at redhat dot com>,<gcc-patches at gcc dot gnu dot org>
- Date: Thu, 2 May 2002 12:11:19 -0400 (EDT)
- Subject: 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
>