aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr66752-3.c
blob: f15b598616600ed2b9147b4e82a930e731be83f3 (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
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-dom1-details -fdump-tree-optimized" } */

extern int status, pt;
extern int count;
void
foo (int N, int c, int b, int *a)
{
  int i, flag;
  i = b -1;
  flag = 1;
  if (status && i < N && a[i] == b) {
    N--;
    flag = 0;
   if (pt)
     count++;
  }
  else    
    for (i = -1, flag = 1; ++i < N && flag;)
      if (a[i] == b)
        {
          --N;
          flag = 0;
          if (i < N)
            a[i] = a[N];
           else
            a[i] = 0;
          if (pt)
            count++;
        }
 if(status && flag)
   pt--;
}

/* There are 3 FSM jump threading opportunities.  */
/* { dg-final { scan-tree-dump-times "FSM" 3 "dom1"} } */

/* There should be no assignments or references to FLAG.  */
/* { dg-final { scan-tree-dump-not "flag" "optimized"} } */