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: Jan Hubicka <hubicka at ucw dot cz>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org, jason at redhat dot com
- Date: Mon, 20 Jan 2014 17:07:18 +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>
> >struct A { char buf[64]; };
> >void foo (char *);
> >void test ()
> >{
> > { A a; foo (a.buf); a.buf[6] = 1; a.buf[7] = 8; }
> > { A a; foo (a.buf); a.buf[6] = 1; a.buf[7] = 8; }
> > { A a; foo (a.buf); a.buf[6] = 1; a.buf[7] = 8; }
> > { A a; foo (a.buf); a.buf[6] = 1; a.buf[7] = 8; }
> > { A a; foo (a.buf); a.buf[6] = 1; a.buf[7] = 8; }
> > { A a; foo (a.buf); a.buf[6] = 1; a.buf[7] = 8; }
> > { A a; foo (a.buf); a.buf[6] = 1; a.buf[7] = 8; }
> >}
> >where with your patch we don't DSE the a.buf[6] and a.buf[7] stores
> >anymore.
I see now.
> >
> >If optimize_clobbers isn't performed at -O0, perhaps we should consider
> >performing at at -O0 (just that and not the other EH optimizations)?
>
> Or, as clobbers are removed during rtl expansion make sure we remove empty eh stuff there?
Removing all the clutter that empty EH causes is quite a lot of work.
In Jakub's testcase we need to output clobber on the non-EH path
foo (&a.buf);
a.buf[6] = 1;
a.buf[7] = 8;
a ={v} {CLOBBER};
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?
I suppose this may make sense to do so even when this try...finally is toplevel to aid
possible inlining. The clobbers on EH are however currently removed by ehcleanup1 that
is before we do any DSE and inlining..
Of course I would not like to have empty EH statemetns with all the unwind logic flying
trhough the inliner's code estimate logic or I will have to teach it to anticipate
their removal.
Honza