| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
int some_f1 (int); |
| 5 |
int some_f2 (int); |
| 6 |
int some_f3 (int); |
| 7 |
|
| 8 |
void remove_this_call (); |
| 9 |
|
| 10 |
int g; |
| 11 |
|
| 12 |
static int __attribute__((noinline)) |
| 13 |
bar (int p) |
| 14 |
{ |
| 15 |
if (p) |
| 16 |
remove_this_call (); |
| 17 |
return g++; |
| 18 |
} |
| 19 |
|
| 20 |
static int __attribute__((noinline)) |
| 21 |
foo (int (*f)(int)) |
| 22 |
{ |
| 23 |
return bar (f == (void *)0); |
| 24 |
} |
| 25 |
|
| 26 |
int |
| 27 |
baz1 (void) |
| 28 |
{ |
| 29 |
int (*f)(int); |
| 30 |
if (g) |
| 31 |
f = some_f1; |
| 32 |
else |
| 33 |
f = some_f2; |
| 34 |
return foo (f); |
| 35 |
} |
| 36 |
|
| 37 |
int |
| 38 |
baz2 (void) |
| 39 |
{ |
| 40 |
int (*f)(int); |
| 41 |
if (g) |
| 42 |
f = some_f2; |
| 43 |
else |
| 44 |
f = some_f3; |
| 45 |
return foo (f); |
| 46 |
} |
| 47 |
|
| 48 |
/* { dg-final { scan-tree-dump-not "remove_this_call" "optimized" } } */ |