aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/dce-2.c
blob: 18c1ddb819eb7a444de31c9eec93ab0fd96cc926 (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-cddce1 -ffinite-loops" } */

typedef struct list {
    char pad[15];
    struct list *next;
} list;

int data;

list *head, *tail;

int __attribute__((pure)) pfn (int);

int foo (unsigned u, int s)
{
  unsigned i;
  list *p;
  int j;

  for (i = 0; i < u; i += 2)
    ;

  for (p = head; p; p = p->next)
    ;

  for (j = data; j & s; j = pfn (j + 3))
    ;

  for (p = head; p != tail; p = p->next)
    for (j = data + 1; j > s; j = pfn (j + 2))
      ;

  return 0;
}
/* { dg-final { scan-tree-dump-not "if" "cddce1"} } */