| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
/* We want this optimized as |
| 5 |
<bb 2>: |
| 6 |
if (k != 0) goto <L2>; else goto <L3>; |
| 7 |
|
| 8 |
<L3>:; |
| 9 |
i1 = j1; |
| 10 |
|
| 11 |
<L2>:; |
| 12 |
return i1; |
| 13 |
|
| 14 |
This requires that i1 and j1 are changed into registers after they |
| 15 |
no longer have their address taken. */ |
| 16 |
|
| 17 |
int f(int k, int i1, int j1) |
| 18 |
{ |
| 19 |
int *f1; |
| 20 |
if(k) |
| 21 |
f1 = &i1; |
| 22 |
else |
| 23 |
f1 = &j1; |
| 24 |
return *f1; |
| 25 |
} |
| 26 |
|
| 27 |
/* { dg-final { scan-tree-dump "\[^\r\n\]*_. = PHI <\[ij\]1_\[^,\]*, \[ij\]1_\[^>\]*>" "optimized" } } */ |