| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O1 -fdump-tree-phiopt1-details -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
int h(void); |
| 5 |
int h1(void); |
| 6 |
|
| 7 |
int f(int a, int b, int d) |
| 8 |
{ |
| 9 |
int c; |
| 10 |
if (a < 0) |
| 11 |
{ |
| 12 |
a = h(); |
| 13 |
c = d > 0 ? d : -d; |
| 14 |
a += h(); |
| 15 |
} |
| 16 |
else |
| 17 |
{ |
| 18 |
a = h1(); |
| 19 |
c = d > 0 ? d : -d; |
| 20 |
a += h1(); |
| 21 |
} |
| 22 |
return a + c; |
| 23 |
} |
| 24 |
|
| 25 |
/* ABS <d> should be not to pulled out of the if statement early on in phiopt1 as it lengthes d's |
| 26 |
live range over a call. |
| 27 |
Note pre can lift the */ |
| 28 |
/* { dg-final { scan-tree-dump-not "changed to factor operation out from " "phiopt1" } } */ |
| 29 |
/* { dg-final { scan-tree-dump "if " "phiopt1" } } */ |
| 30 |
/* { dg-final { scan-tree-dump "if " "optimized" } } */ |
| 31 |
/* There will be 2 ABS due to the need for it in the inner if. */ |
| 32 |
/* { dg-final { scan-tree-dump-times "ABS_EXPR " 2 "phiopt1" } } */ |
| 33 |
/* { dg-final { scan-tree-dump-times "ABS_EXPR " 2 "optimized" } } */ |