111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-options "-O2 -fdump-tree-thread1-stats -fdump-tree-thread2-stats -fdump-tree-dom2-stats -fdump-tree-thread3-stats -fdump-tree-dom3-stats -fdump-tree-vrp2-stats -fno-guess-branch-probability" } */
|
|
3 /* { dg-final { scan-tree-dump "Jumps threaded: 16" "thread1" } } */
|
|
4 /* { dg-final { scan-tree-dump "Jumps threaded: 9" "thread2" } } */
|
131
|
5 /* { dg-final { scan-tree-dump "Jumps threaded: 1" "dom2" } } */
|
111
|
6 /* { dg-final { scan-tree-dump-not "Jumps threaded" "dom3" } } */
|
|
7 /* { dg-final { scan-tree-dump-not "Jumps threaded" "vrp2" } } */
|
|
8
|
131
|
9 /* Most architectures get 3 threadable paths here, whereas aarch64 and
|
|
10 possibly others get 5. We really should rewrite threading tests to
|
|
11 test a specific IL sequence, not gobs of code whose IL can vary
|
|
12 from architecture to architecture. */
|
|
13 /* { dg-final { scan-tree-dump "Jumps threaded: \[35\]" "thread3" } } */
|
|
14
|
111
|
15 enum STATE {
|
|
16 S0=0,
|
|
17 SI,
|
|
18 S1,
|
|
19 S2,
|
|
20 S3,
|
|
21 S4,
|
|
22 S5,
|
|
23 S6
|
|
24 };
|
|
25
|
|
26 int bar (enum STATE s);
|
|
27
|
|
28 enum STATE foo (unsigned char **y, unsigned *c)
|
|
29 {
|
|
30 unsigned char *x = *y;
|
|
31 unsigned char n;
|
|
32 enum STATE s = S0;
|
|
33
|
|
34 for( ; *x && s != SI; x++ )
|
|
35 {
|
|
36 n = *x;
|
|
37 if (n == 'x')
|
|
38 {
|
|
39 x++;
|
|
40 break;
|
|
41 }
|
|
42 switch(s)
|
|
43 {
|
|
44 case S0:
|
|
45 if(bar(n))
|
|
46 s = S3;
|
|
47 else if( n == 'a' || n == 'b' )
|
|
48 s = S1;
|
|
49 else if( n == 'c' )
|
|
50 s = S4;
|
|
51 else
|
|
52 {
|
|
53 s = SI;
|
|
54 c[SI]++;
|
|
55 }
|
|
56 c[S0]++;
|
|
57 break;
|
|
58 case S1:
|
|
59 if(bar(n))
|
|
60 {
|
|
61 s = S3;
|
|
62 c[S1]++;
|
|
63 }
|
|
64 else if( n == 'c' )
|
|
65 {
|
|
66 s = S4;
|
|
67 c[S1]++;
|
|
68 }
|
|
69 else
|
|
70 {
|
|
71 s = SI;
|
|
72 c[S1]++;
|
|
73 }
|
|
74 break;
|
|
75 case S3:
|
|
76 if( n == 'c' )
|
|
77 {
|
|
78 s = S4;
|
|
79 c[S3]++;
|
|
80 }
|
|
81 else if(!bar(n))
|
|
82 {
|
|
83 s = SI;
|
|
84 c[S3]++;
|
|
85 }
|
|
86 break;
|
|
87 case S4:
|
|
88 if( n == 'E' || n == 'e' )
|
|
89 {
|
|
90 s = S2;
|
|
91 c[S4]++;
|
|
92 }
|
|
93 else if(!bar(n))
|
|
94 {
|
|
95 s = SI;
|
|
96 c[S4]++;
|
|
97 }
|
|
98 break;
|
|
99 case S2:
|
|
100 if( n == 'a' || n == 'b' )
|
|
101 {
|
|
102 s = S5;
|
|
103 c[S2]++;
|
|
104 }
|
|
105 else
|
|
106 {
|
|
107 s = SI;
|
|
108 c[S2]++;
|
|
109 }
|
|
110 break;
|
|
111 case S5:
|
|
112 if(bar(n))
|
|
113 {
|
|
114 s = S6;
|
|
115 c[S5]++;
|
|
116 }
|
|
117 else
|
|
118 {
|
|
119 s = SI;
|
|
120 c[S5]++;
|
|
121 }
|
|
122 break;
|
|
123 case S6:
|
|
124 if(!bar(n))
|
|
125 {
|
|
126 s = SI;
|
|
127 c[SI]++;
|
|
128 }
|
|
129 break;
|
|
130 default:
|
|
131 break;
|
|
132 }
|
|
133 }
|
|
134 *y=x;
|
|
135 return s;
|
|
136 }
|