| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-Os -fdump-tree-pre-stats -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
void foo(void); |
| 5 |
static int c = 76, f, g; |
| 6 |
static int *h, *j, *k = &g; |
| 7 |
static int **i = &h; |
| 8 |
static short a; |
| 9 |
static signed char(l)(signed char b) { |
| 10 |
if (!(((b) >= 77) && ((b) <= 77))) { |
| 11 |
__builtin_unreachable(); |
| 12 |
} |
| 13 |
return 0; |
| 14 |
} |
| 15 |
static short(m)(short d, short e) { return d + e; } |
| 16 |
static short n(signed char) { |
| 17 |
j = *i; |
| 18 |
if (j == 0) |
| 19 |
; |
| 20 |
else |
| 21 |
*i = 0; |
| 22 |
*k = 0; |
| 23 |
return 0; |
| 24 |
} |
| 25 |
static signed char o() { |
| 26 |
l(0); |
| 27 |
return 0; |
| 28 |
} |
| 29 |
static signed char p(int ad) { |
| 30 |
a = m(!0, ad); |
| 31 |
l(a); |
| 32 |
if (f) { |
| 33 |
*i &&n(o()); |
| 34 |
*i = 0; |
| 35 |
} else |
| 36 |
n(0); |
| 37 |
if (h == &f || h == 0) |
| 38 |
; |
| 39 |
else |
| 40 |
foo(); |
| 41 |
return 0; |
| 42 |
} |
| 43 |
int main() { |
| 44 |
p(c); |
| 45 |
c = 8; |
| 46 |
} |
| 47 |
|
| 48 |
/* Even with main being cold we should optimize the redundant load of h |
| 49 |
which is available on all incoming edges (but none considered worth |
| 50 |
optimizing for speed) when doing that doesn't needlessly increase |
| 51 |
code size. */ |
| 52 |
|
| 53 |
/* { dg-final { scan-tree-dump "Insertions: 1" "pre" } } */ |
| 54 |
/* { dg-final { scan-tree-dump "HOIST inserted: 1" "pre" } } */ |
| 55 |
/* { dg-final { scan-tree-dump "Eliminated: 3" "pre" } } */ |
| 56 |
/* { dg-final { scan-tree-dump-not "foo" "optimized" } } */ |