This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Do not produce empty try-finally statements
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, gcc-patches at gcc dot gnu dot org, jason at redhat dot com
- Date: Mon, 20 Jan 2014 17:16:42 +0100
- Subject: Re: Do not produce empty try-finally statements
- Authentication-results: sourceware.org; auth=none
- References: <20140119224609 dot GB22057 at kam dot mff dot cuni dot cz> <20140120070735 dot GT892 at tucnak dot redhat dot com> <69409e4c-102f-4aaf-b79b-9ec982348162 at email dot android dot com> <20140120160717 dot GB4030 at kam dot mff dot cuni dot cz>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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