Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/pr105832-3.c

raw
1 /* PR tree-optimization/105832 */
2 /* { dg-do compile } */
3 /* Disable the first forwprop1 as that will catch f2/f4 even though `&1`
4 will be removed during evrp. */
5 /* { dg-options "-O2 -fdisable-tree-forwprop1 -fdump-tree-optimized" } */
6 /* { dg-final { scan-tree-dump "a_\[0-9]+\\(D\\) == 0" "optimized" } } */
7 /* { dg-final { scan-tree-dump "b_\[0-9]+\\(D\\) == 0" "optimized" } } */
8 /* { dg-final { scan-tree-dump "c_\[0-9]+\\(D\\) != 0" "optimized" } } */
9 /* { dg-final { scan-tree-dump "d_\[0-9]+\\(D\\) != 0" "optimized" } } */
10
11 int g(void);
12 int h(void);
13
14 int
15 f1 (int a)
16 {
17 int t = 1 >> a;
18 if (t != 0) return g();
19 return h();
20 }
21
22 int
23 f2 (int b)
24 {
25 int t = 1 >> b;
26 t &= 1;
27 if (t != 0) return g();
28 return h();
29 }
30
31 int
32 f3 (int c)
33 {
34 int t = 1 >> c;
35 if (t == 0) return g();
36 return h();
37 }
38
39 int
40 f4 (int d)
41 {
42 int t = 1 >> d;
43 t &= 1;
44 if (t == 0) return g();
45 return h();
46 }