This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Do not produce empty try-finally statements


> >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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]