111
|
1 /* { dg-do compile } */
|
131
|
2 /* { dg-options "-O3 -fgimple -fdump-tree-cunroll-blocks-details" } */
|
111
|
3
|
|
4 #if __SIZEOF_INT__ < 4
|
|
5 __extension__ typedef __INT32_TYPE__ i32;
|
|
6 #else
|
|
7 typedef int i32;
|
|
8 #endif
|
|
9
|
131
|
10 struct a {i32 a[8];i32 b;};
|
|
11
|
|
12 void __GIMPLE (startwith("fix_loops"))
|
|
13 t (struct a * a)
|
111
|
14 {
|
131
|
15 i32 i;
|
|
16 i32 _1;
|
|
17 i32 _2;
|
|
18 i32 _9;
|
|
19 i32 _11;
|
|
20
|
|
21 bb_2:
|
|
22 _11 = a_6(D)->a[0];
|
|
23 if (_11 != _Literal (i32) 0)
|
|
24 goto bb_6;
|
|
25 else
|
|
26 goto bb_3;
|
|
27
|
|
28 bb_3:
|
|
29 return;
|
|
30
|
|
31 bb_4:
|
|
32 _1 = _2 + 1;
|
|
33 a_6(D)->a[i_19] = _1;
|
|
34 i_8 = i_19 + _Literal (i32) 1;
|
|
35 if (i_8 <= _Literal (i32) 123455)
|
|
36 goto bb_5;
|
|
37 else
|
|
38 goto bb_3;
|
|
39
|
|
40 bb_5:
|
|
41 i_19 = __PHI (bb_6: _Literal (i32) 1, bb_4: i_8);
|
|
42 _2 = a_6(D)->a[i_19];
|
|
43 if (_2 != _Literal (i32) 0)
|
|
44 goto bb_4;
|
|
45 else
|
|
46 goto bb_3;
|
|
47
|
|
48 bb_6:
|
|
49 _9 = _11 + _Literal (i32) 1;
|
|
50 a_6(D)->a[0] = _9;
|
|
51 goto bb_5;
|
111
|
52 }
|
131
|
53
|
|
54 /* This testcase relies on the fact that we do not eliminate the redundant test
|
|
55 for i early. It is necessary to disable all passes that do so, for the
|
|
56 moment starting with the loop pipeline is good enough. */
|
111
|
57 /* { dg-final { scan-tree-dump-times "Loop 1 iterates 123454 times" 1 "cunroll" } } */
|
|
58 /* { dg-final { scan-tree-dump-times "Last iteration exit edge was proved true" 1 "cunroll" } } */
|
|
59 /* { dg-final { scan-tree-dump-times "Exit condition of peeled iterations was eliminated" 1 "cunroll" } } */
|
131
|
60 /* { dg-final { scan-tree-dump-times "loop with 6 iterations completely unrolled" 1 "cunroll" } } */
|
111
|
61 /* { dg-final { scan-tree-dump-not "Invalid sum" "cunroll" } } */
|