aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-6.c
blob: 1122e6b00e1c0d7c48292a765c527c65e2a210aa (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* { dg-do compile } */
/* { dg-options "-O1 -fno-tree-dominator-opts -fdump-tree-ccp" } */

extern void link_error (void);

/* tests to check if some identities can be proven by the compiler  */


void test6 (unsigned int a)
{
  if (a != a)
    link_error ();
}

void test66 (unsigned int a)
{
  unsigned int b = a;
  if (b != a)
    link_error ();
}

void test666 (unsigned int a)
{
  unsigned int b = a - 32;
  if (b != (a - 32))
    link_error ();
}

void test6666 (unsigned int a)
{
  if (a-32 != a-32)
    link_error ();
}



/* 
   This should be moved to a place that scans the copyprop dump
*/

void test66666 (int a)
{
  int b = a;
  if (a > 25)
    {
      int c = b;
      if (c < 30)
        {
          int d = c;
          if (d != a)
            link_error ();

        }
    }
}


/* There should be not link_error calls, if there is any the
   optimization has failed */
/* { dg-final { scan-tree-dump-times "link_error" 0 "ccp"} } */