summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-11.c
blob: 4eaad28b177e5869bf0a20a2a6994e72fc28d027 (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
/* { dg-do compile } */ 
/* { dg-options "-O1 -fdump-tree-optimized" } */

/* Test for CPROP across a DAG. */

int test111 (int param)
{
  int a, b, c;
  if (param) {
    a = 3;
    b = 2;
  }
  else {
    a = 2;
    b = 3;
  }
  c = a + b;
  if (c != 5)
    return 2;
  return 0;
}

int test1111 (int param)
{
  _Bool a, b, c;
  if (param) {
    a = 1;
    b = 0;
  }
  else {
    a = 0;
    b = 1;
  }
  c = a && b;
  if (c)
    return 2;
  return 0;
}

/* All ifs should be eliminated. */
/* { dg-final { scan-tree-dump-times "if " 0 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */