Do not produce empty try-finally statements

Jakub Jelinek jakub@redhat.com
Mon Jan 20 16:16:00 GMT 2014


On Mon, Jan 20, 2014 at 05:07:18PM +0100, Jan Hubicka wrote:
> So I guess we can not modify giplifier to output
>         foo (&a.buf);
>         a.buf[6] = 1;
>         a.buf[7] = 8;
>         a = {CLOBBER};
> 
> instead of
> 
>     try
>       { 
>         foo (&a.buf);
>         a.buf[6] = 1;
>         a.buf[7] = 8;
>       }
>     finally
>       { 
>         a = {CLOBBER};
>       }
> 
> Whenever A is just CLOBBER because we care about dead store over the possible EH path?

Yes.  Say, this could be surrounded by some try/catch, if we do it the first
way, a would be still considered live across the EH path to whatever catches
it.

The EH optimizations involving cleanups with only clobbers in them are that
if at the end of the cleanup after only CLOBBER stmts you would rethrow the exception
externally, then the clobber isn't needed and the whole cleanup can be
removed.  And, if it rethrows somewhere internally, we can move the clobber
stmts to the landing pad of wherever it would be caught.

	Jakub



More information about the Gcc-patches mailing list