Do not produce empty try-finally statements

Richard Biener richard.guenther@gmail.com
Mon Jan 20 08:13:00 GMT 2014


Jakub Jelinek <jakub@redhat.com> wrote:
>On Sun, Jan 19, 2014 at 11:46:09PM +0100, Jan Hubicka wrote:
>> Bootstrapped/regtested x86_64-linux, OK?
>
>This looks very wrong.  By ignoring the clobbers in the cleanups you
>ensure clobbers are hardly ever emitted, but the TRY/FINALLY is the way
>how
>to make sure the clobbers appear in all the places where they are
>supposed
>to be, so that DSE, expansion etc. can take advantage of them.
>Just look at say:
>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.
>
>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?

Richard.

>	Jakub




More information about the Gcc-patches mailing list