This is the mail archive of the
mailing list for the GCC project.
Re: COND_EXPR lowering patch
On Mon, 2003-08-25 at 13:33, Zdenek Dvorak wrote:
> > >The main showstopper seems to be the tree-ssa-dce; after this change
> > >it cannot work in the current form (resp. it could, but since most
> > > of the interesting control flow will then be expressed by explicit
> > > gotos, it would be useless).
> > Actually, as I've stated before, I believe the existing tree-ssa-dce
> > should continue to work, even after you've lowered COND_EXPRs because
> > we mark the parents of an incoming GOTO_EXPR as being necessary.
> yes, it will work, but it will be completely useless. Consider
> if (a)
> written as
> if (a)
> goto _then;
> goto _else;
> goto _end;
> as the code works now all statements here including the condition
> will be marked as useful.
So you are saying that if anything after _end: is marked as necessary,
then 'goto _end' will be marked as necessary, which will in turn will
mark the 'goto _then' as necessary, which will cause the condition to be
marked as necessary... so it can never be eliminated?
Is that correct?
if we switch from parent_stmt's we'll be changing the way we mark
necessary goto's. The algorithm states that we only mark *conditional*
goto's as necessary on control dependant edges. So having a stmt in the
block starting with _end: will not cause the 'goto _end' stmt to be
marked as necessary. Only stmt's between
will cause the if() to be marked as necessary.
So I think we could still eliminate the whole thing. (btw, since we are
explicitly exposing out GOTO's in the IL, that means any stmt which is
marked as necessary which is in a block which ends in an unconditional
goto must also mark the goto as necessary).