summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr20913.c
blob: fb5461a26092ff493c7dd32e2c547327a398c46f (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
/* PR tree-optimization/20913
   COPY-PROP did not fold COND_EXPR, blocking some copy propagation
   opportunities.  */

/* { dg-do link } */
/* { dg-options "-O2 -fno-tree-dominator-opts" } */

int
foo (int a, int b, int c, int d)
{
  int x, y;

  b = a;
  if (a == b)
    x = c;
  else
    {
      link_error ();
      x = d;
    }

  if (x == c)
    return a;
  else
    {
      link_error ();
      return b;
    }
}

main()
{
  foo (1, 2, 3, 4);
}