aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr105832-3.c
blob: 2bdd9afcbc79ff707c5db10057a978df586300e7 (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
35
36
37
38
39
40
41
42
43
44
45
46
/* PR tree-optimization/105832 */
/* { dg-do compile } */
/* Disable the first forwprop1 as that will catch f2/f4 even though `&1`
   will be removed during evrp. */
/* { dg-options "-O2 -fdisable-tree-forwprop1 -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump "a_\[0-9]+\\(D\\) == 0" "optimized" } } */
/* { dg-final { scan-tree-dump "b_\[0-9]+\\(D\\) == 0" "optimized" } } */
/* { dg-final { scan-tree-dump "c_\[0-9]+\\(D\\) != 0" "optimized" } } */
/* { dg-final { scan-tree-dump "d_\[0-9]+\\(D\\) != 0" "optimized" } } */

int g(void);
int h(void);

int
f1 (int a)
{
  int t = 1 >> a;
  if (t != 0) return g();
  return h();
}

int
f2 (int b)
{
  int t = 1 >> b;
  t &= 1;
  if (t != 0) return g();
  return h();
}

int
f3 (int c)
{
  int t = 1 >> c;
  if (t == 0) return g();
  return h();
}

int
f4 (int d)
{
  int t = 1 >> d;
  t &= 1;
  if (t == 0) return g();
  return h();
}