2018-04-30 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / cunroll-13.c
blobbaac6b493ea8ee22a4d7898cf0e62a51a05798d2
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fgimple -fdump-tree-cunroll-blocks-details" } */
4 #if __SIZEOF_INT__ < 4
5 __extension__ typedef __INT32_TYPE__ i32;
6 #else
7 typedef int i32;
8 #endif
10 struct a {i32 a[8];i32 b;};
12 void __GIMPLE (startwith("fix_loops"))
13 t (struct a * a)
15 i32 i;
16 i32 _1;
17 i32 _2;
18 i32 _9;
19 i32 _11;
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;
28 bb_3:
29 return;
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;
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;
48 bb_6:
49 _9 = _11 + _Literal (i32) 1;
50 a_6(D)->a[0] = _9;
51 goto bb_5;
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. */
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" } } */
60 /* { dg-final { scan-tree-dump-times "loop with 6 iterations completely unrolled" 1 "cunroll" } } */
61 /* { dg-final { scan-tree-dump-not "Invalid sum" "cunroll" } } */