summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/loop-5.c
blob: f0ba475c7984b93760db5a8b8950565e901d8998 (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
/* A test for induction variable merging.  */

/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-optimized" } */

void foo(long);

void xxx(void)
{
  long iter, jter;

  for (iter = 0, jter = 2; iter < 100; iter++, jter++)
    {
      foo (iter);
      foo (jter);
    }
}

/* Only iter variable should remain.  */

/* { dg-final { scan-tree-dump-times "int iter" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "jter" 0 "optimized" } } */

/* And the use of jter should be replaced by iter + 2 */

/* { dg-final { scan-tree-dump-times " \\+ 2" 1 "optimized" } } */

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