| 1 |
// { dg-do compile } |
| 2 |
// { dg-options "-O2 -fgimple -fdump-statistics" } |
| 3 |
// |
| 4 |
// This is a collection of seemingly threadble paths that should not be allowed. |
| 5 |
|
| 6 |
void foobar (int); |
| 7 |
|
| 8 |
// Possible thread from 2->4->3, but it would rotate the loop. |
| 9 |
void __GIMPLE (ssa) |
| 10 |
f1 () |
| 11 |
{ |
| 12 |
int i; |
| 13 |
|
| 14 |
// Pre-header. |
| 15 |
__BB(2): |
| 16 |
goto __BB4; |
| 17 |
|
| 18 |
// Latch. |
| 19 |
__BB(3): |
| 20 |
foobar (i_1); |
| 21 |
i_5 = i_1 + 1; |
| 22 |
goto __BB4; |
| 23 |
|
| 24 |
__BB(4,loop_header(1)): |
| 25 |
i_1 = __PHI (__BB2: 0, __BB3: i_5); |
| 26 |
if (i_1 != 101) |
| 27 |
goto __BB3; |
| 28 |
else |
| 29 |
goto __BB5; |
| 30 |
|
| 31 |
__BB(5): |
| 32 |
return; |
| 33 |
|
| 34 |
} |
| 35 |
|
| 36 |
// Possible thread from 2->3->5 but threading through the empty latch |
| 37 |
// would create a non-empty latch. |
| 38 |
void __GIMPLE (ssa) |
| 39 |
f2 () |
| 40 |
{ |
| 41 |
int i; |
| 42 |
|
| 43 |
// Pre-header. |
| 44 |
__BB(2): |
| 45 |
goto __BB3; |
| 46 |
|
| 47 |
__BB(3,loop_header(1)): |
| 48 |
i_8 = __PHI (__BB5: i_5, __BB2: 0); |
| 49 |
foobar (i_8); |
| 50 |
i_5 = i_8 + 1; |
| 51 |
if (i_5 != 256) |
| 52 |
goto __BB5; |
| 53 |
else |
| 54 |
goto __BB4; |
| 55 |
|
| 56 |
// Latch. |
| 57 |
__BB(5): |
| 58 |
goto __BB3; |
| 59 |
|
| 60 |
__BB(4): |
| 61 |
return; |
| 62 |
|
| 63 |
} |
| 64 |
|
| 65 |
// Possible thread from 3->5->6->3 but this would thread through the |
| 66 |
// header but not exit the loop. |
| 67 |
int __GIMPLE (ssa) |
| 68 |
f3 (int a) |
| 69 |
{ |
| 70 |
int i; |
| 71 |
|
| 72 |
__BB(2): |
| 73 |
goto __BB6; |
| 74 |
|
| 75 |
__BB(3): |
| 76 |
if (i_1 != 0) |
| 77 |
goto __BB4; |
| 78 |
else |
| 79 |
goto __BB5; |
| 80 |
|
| 81 |
__BB(4): |
| 82 |
foobar (5); |
| 83 |
goto __BB5; |
| 84 |
|
| 85 |
// Latch. |
| 86 |
__BB(5): |
| 87 |
i_7 = i_1 + 1; |
| 88 |
goto __BB6; |
| 89 |
|
| 90 |
__BB(6,loop_header(1)): |
| 91 |
i_1 = __PHI (__BB2: 1, __BB5: i_7); |
| 92 |
if (i_1 <= 99) |
| 93 |
goto __BB3; |
| 94 |
else |
| 95 |
goto __BB7; |
| 96 |
|
| 97 |
__BB(7): |
| 98 |
return; |
| 99 |
|
| 100 |
} |
| 101 |
|
| 102 |
// { dg-final { scan-tree-dump-not "Jumps threaded" "statistics" } } |