aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c
blob: a9011ce97fb1e5c4264c840eb7440bf45ab3f125 (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
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-phiopt" } */
/* PR tree-optimization/111957 */

int f(int a)
{
  if (a)
    return a > 0 ? a : -a;
  return 0;
}

int f1(int x)
{
  int intmin = (-1u >> 1);
  intmin = -intmin - 1;
  if (x != intmin)
    return x > 0 ? x : -x;
  return intmin;
}

/* { dg-final { scan-tree-dump-times "if " 1 "phiopt1" } } */
/* { dg-final { scan-tree-dump-not "if " "phiopt2" } } */
/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 2 "phiopt1" } } */
/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 1 "phiopt2" } } */
/* { dg-final { scan-tree-dump-times "ABSU_EXPR <" 1 "phiopt2" } } */