aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-8.c
blob: 4b23b567fd02032142d3fa3f88be08f60e150d46 (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
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-sink" } */

int foo(int *a, int r, short *b)
{
  int ret = 0;
  *a = 1;
  switch (r)
    {
      case 3:
	  *a = 5;
	  break;
      case 4:
      case 5:
	  *a = 9;
	  ret = r + 25;
	  break;
      default:
	  ret = r + 20;
    }
  *b = 9;
  return ret;
}

/* *a = 1 should be sunk into the default case.  */

/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink1" } } */