[PATCH] Add PAREN_EXPR

Paolo Bonzini bonzini@gnu.org
Wed Feb 20 10:39:00 GMT 2008


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

> + ! 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".

Paolo



More information about the Fortran mailing list