| 1 |
/* PR rtl-optimization/98289 */ |
| 2 |
/* { dg-do compile { target { ! ia32 } } } */ |
| 3 |
/* { dg-require-effective-target freorder } */ |
| 4 |
/* { dg-options "-O2 -freorder-blocks-and-partition -fdump-rtl-pro_and_epilogue-details" } */ |
| 5 |
/* { dg-final { scan-rtl-dump-times "Performing shrink-wrapping" 4 "pro_and_epilogue" } } */ |
| 6 |
|
| 7 |
int bar (void) __attribute__((cold)); |
| 8 |
|
| 9 |
void |
| 10 |
foo (int x) |
| 11 |
{ |
| 12 |
if (x) |
| 13 |
__builtin_abort (); |
| 14 |
} |
| 15 |
|
| 16 |
void |
| 17 |
baz (int x) |
| 18 |
{ |
| 19 |
if (__builtin_expect (x, 0)) |
| 20 |
{ |
| 21 |
bar (); |
| 22 |
bar (); |
| 23 |
bar (); |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
void |
| 28 |
qux (int x, int y, int z, int w) |
| 29 |
{ |
| 30 |
if (x || y || z || w) |
| 31 |
__builtin_abort (); |
| 32 |
} |
| 33 |
|
| 34 |
int |
| 35 |
corge (int x, int y, int z, int w, int u) |
| 36 |
{ |
| 37 |
if (__builtin_expect (x, 0)) |
| 38 |
goto lab; |
| 39 |
u++; |
| 40 |
if (__builtin_expect (y, 0)) |
| 41 |
goto lab; |
| 42 |
u *= 2; |
| 43 |
if (__builtin_expect (z, 0)) |
| 44 |
goto lab; |
| 45 |
u |= 42; |
| 46 |
if (__builtin_expect (w, 0)) |
| 47 |
{ |
| 48 |
lab:; |
| 49 |
bar (); |
| 50 |
bar (); |
| 51 |
if (bar () > 32) goto lab; |
| 52 |
} |
| 53 |
return u; |
| 54 |
} |