aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-factor-1.c
blob: 12b846b9337f2be9cbfe4047de7ab93f33742dee (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
/* { dg-options "-O2 -fdump-tree-phiopt" } */

/* PR tree-optimization/116699
   Make sure the return PREDICT has no factor in deciding
   if we factor out the conversion. */

short f0(int a, int b, int c)
{
  int t1 = 4;
  if (c < t1)  return (c > -1 ? c : -1);
  return t1;
}


short f1(int a, int b, int c)
{
  int t1 = 4;
  short t = t1;
  if (c < t1)  t = (c > -1 ? c : -1);
  return t;
}

/* Both f1 and f0  should be optimized at phiopt1 to the same thing. */
/* { dg-final { scan-tree-dump-times "MAX_EXPR " 2 "phiopt1" } } */
/* { dg-final { scan-tree-dump-times "MIN_EXPR " 2  "phiopt1" } } */
/* { dg-final { scan-tree-dump-not "if " "phiopt1" } } */