summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/loop-10.c
blob: c8d118e37715782ab525da4abc22c4aebdefba29 (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
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-require-effective-target int32plus } */

int bar (void);

void foo (void)
{
  unsigned i, j, n;

  for (i = 0; i < 100000; i++)
    ;

  n = bar ();
  for (i = 0; i < n; i++)
    ;

  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      ;

  /* These should not be removed.  */
  for (i = 0; i < 10000; i++)
    bar ();

  for (i = 0; i != n; i += 2)
    ;
}

/* { dg-final { scan-tree-dump-times "if " 3 "optimized" } } */
/* { dg-final { scan-tree-dump-times "bar " 2 "optimized" } } */

/* { dg-final { cleanup-tree-dump "optimized" } } */