| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O -fno-tree-fre -fdump-tree-dom2" } */ |
| 3 |
|
| 4 |
extern void abort (void); |
| 5 |
|
| 6 |
int a; |
| 7 |
int __attribute__((noinline)) |
| 8 |
foo (int b) |
| 9 |
{ |
| 10 |
a = 0; |
| 11 |
if (b) |
| 12 |
{ |
| 13 |
a = 1; |
| 14 |
return a; |
| 15 |
} |
| 16 |
/* DOM should be able to CSE both loads here, forwarding 0 and 1 |
| 17 |
to the PHI feeding the return. */ |
| 18 |
return a; |
| 19 |
} |
| 20 |
|
| 21 |
int |
| 22 |
main() |
| 23 |
{ |
| 24 |
if (foo (0) != 0 |
| 25 |
|| foo (1) != 1) |
| 26 |
abort (); |
| 27 |
return 0; |
| 28 |
} |
| 29 |
|
| 30 |
/* { dg-final { scan-tree-dump "= PHI <\[01\]\\\(.\\\), \[01\]\\\(.\\\)>" "dom2" } } */ |