| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-reassoc1" } */ |
| 3 |
|
| 4 |
int f (int a, int b) |
| 5 |
{ |
| 6 |
int x = -a; |
| 7 |
int y = b - x; |
| 8 |
return y; |
| 9 |
} |
| 10 |
|
| 11 |
/* We tested for reassociation to -(a + b) on the following which |
| 12 |
isn't a transform that makes things cheaper. With reassoc |
| 13 |
no longer applying to types with undefined overflow we lost |
| 14 |
this transform. |
| 15 |
|
| 16 |
int g (int a, int b) |
| 17 |
{ |
| 18 |
int x = -a; |
| 19 |
int y = x - b; |
| 20 |
return y; |
| 21 |
} |
| 22 |
|
| 23 |
*/ |
| 24 |
|
| 25 |
/* There should be an addition now. */ |
| 26 |
/* { dg-final { scan-tree-dump-times "\\+" 1 "reassoc1"} } */ |