This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: [PATCH] Add PAREN_EXPR


On Wed, 20 Feb 2008, Paolo Bonzini wrote:

> > The fold_unary hunk deals with the CCP case.
> 
> Can you add a testcase?  Something like.
> 
> b = a + (a + 5 - a) - 5
> 
> being optimized to "b = a".

Sure.

> > + ! Make sure that FRE does not replace c with b in d = c - 5
> > + + function test(a)
> > +   real a, b, c, d
> > +   b = a + 5.
> > +   c = (a + 5.)
> > +   d = c - 5.
> > +   call foo(b)
> > +   test = d
> > + end
> > + + ! { dg-final { scan-tree-dump "\\\+ 5.*\\\)\\\) - 5" "optimized" } }
> 
> I think this test is too strict.  In fact the best optimization would be
> 
>   b = a + 5.
>   call foo (b)
>   test = (b) - 5.
> 
> You could just test for presence of "- 5".

Hm, actually this is what happens:

<bb 2>:
  b.0 = *a + 5.0e+0;
  b = b.0;
  foo (&b);
  return ((b.0)) - 5.0e+0;

no idea why my pattern matches this ;)  I'll adjust it as you suggested.

Thanks,
Richard.


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