aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/cunroll-13.c
blob: 98cb56a8564becfc8d5cd0253fa74f23ccf1bc77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* { dg-do compile } */
/* { dg-options "-O3 -fgimple -fdump-tree-cunroll-blocks-details" } */

#if __SIZEOF_INT__ < 4
__extension__ typedef __INT32_TYPE__ i32;
#else
typedef int i32;
#endif

struct a {i32 a[8];i32 b;};

void __GIMPLE (ssa,startwith("fix_loops"))
t (struct a * a)
{
  i32 i;
  i32 _1;
  i32 _2;
  i32 _9;
  i32 _11;

__BB(2):
  _11 = a_6(D)->a[0];
  if (_11 != _Literal (i32) 0)
    goto __BB6;
  else
    goto __BB3;

__BB(3):
  return;

__BB(4):
  _1 = _2 + _Literal (i32) 1;
  a_6(D)->a[i_19] = _1;
  i_8 = i_19 + _Literal (i32) 1;
  if (i_8 <= _Literal (i32) 123455)
    goto __BB5;
  else
    goto __BB3;

__BB(5):
  i_19 = __PHI (__BB6: _Literal (i32) 1, __BB4: i_8);
  _2 = a_6(D)->a[i_19];
  if (_2 != _Literal (i32) 0)
    goto __BB4;
  else
    goto __BB3;

__BB(6):
  _9 = _11 + _Literal (i32) 1;
  a_6(D)->a[0] = _9;
  goto __BB5;
}

/* This testcase relies on the fact that we do not eliminate the redundant test
   for i early.  It is necessary to disable all passes that do so, for the
   moment starting with the loop pipeline is good enough.  */
/* { dg-final { scan-tree-dump-times "Loop 1 iterates 123454 times" 1 "cunroll" } } */
/* { dg-final { scan-tree-dump-times "Last iteration exit edge was proved true" 1 "cunroll" } } */
/* { dg-final { scan-tree-dump-times "Exit condition of peeled iterations was eliminated" 1 "cunroll" } } */
/* { dg-final { scan-tree-dump-times "loop with 6 iterations completely unrolled" 1 "cunroll" } } */
/* { dg-final { scan-tree-dump-not "Invalid sum" "cunroll" } } */