summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/forwprop-31.c
blob: e146ade61afb4cc69df20c16f35ebbeaa11396d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* { dg-do compile } */
/* { dg-options "-O -fno-tree-ccp -fdump-tree-forwprop1" } */

int foo (int x)
{
  int y = 0;
  int z = x + 1;
  int w = z + y; /* becomes z */
  return w - z; /* becomes 0 */
}

/* The original y = 0 stmt is also retained.  */
/* { dg-final { scan-tree-dump-times "= 0;" 2 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "-" 0 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "\\+" 1 "forwprop1" } } */