summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr19590.c
blob: 1be1119dac0b3d1d46c0b1d7a51dddbaa8d0ec1e (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
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-ivopts" } */

void vnum_test8(int *data) 
{ 
  int i; 
  int stop = data[3]; 
  int m = data[4]; 
  int n = m; 
  for (i=1; i<stop; i++) { 
    int k = data[2]; 
    data[k] = 2; 
    data[0] = m - n; 
    k = data[1]; 
    m = m + k; 
    n = n + k; 
  } 
} 

/* Using the SCEV analysis, this loop should be transformed to:

   | void vnum_result8(int *data) 
   |{ 
   |  int i; 
   |  int stop = data[3]; 
   |  for (i=1; i<stop; i++) { 
   |    int k = data[2]; 
   |    data[k] = 2; 
   |    data[0] = 0; 
   |  } 
   |}

*/

/* { dg-final { scan-tree-dump-times "= 0;" 1 "ivopts"} } */
/* { dg-final { scan-tree-dump-times "= 2;" 1 "ivopts"} } */
/* { dg-final { cleanup-tree-dump "ivopts" } }  */