gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-25.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -fdump-tree-pre-stats" } */ |
| 3 | |
| 4 | struct X { int i; }; |
| 5 | |
| 6 | int foo (int x) |
| 7 | { |
| 8 | struct X a; |
| 9 | struct X b; |
| 10 | struct X *p; |
| 11 | a.i = 1; |
| 12 | b.i = 2; |
| 13 | if (x) |
| 14 | p = &a; |
| 15 | else |
| 16 | p = &b; |
| 17 | return p->i; |
| 18 | } |
| 19 | |
| 20 | /* We should eliminate the load from p for a PHI node with values 1 and 2. */ |
| 21 | |
| 22 | /* { dg-final { scan-tree-dump "Eliminated: 1" "pre" } } */ |