Do not produce empty try-finally statements

Richard Biener
Tue Jan 28 10:48:00 GMT 2014

On Mon, Jan 20, 2014 at 5:22 PM, Jan Hubicka <> wrote:
>> 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.
> OK, I still do not see how ehclanup1 can then safely remove them pre-inline
> given that the whole function body can be inlined into another containing the
> outer EH region.

That's true.

>  If this is valid, why we can not just eliminate EH in those
> outer clobber try..finally as part of ehlowering earlier?

Probably we'd miss too many inlining cases from early inlining and
the ehcleanup1 time is just a heuristic that works good enough for us?

Jakub?  Micha?


> Honza
>>       Jakub

More information about the Gcc-patches mailing list