Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/fre-predicated-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3
4 /* PR tree-optimization/117414 */
5
6 /* Fre1 should figure out that `*aaa != 0`
7 For f0, f1, and f2. */
8
9
10 void foo();
11 int f0(int *aaa, int j, int t)
12 {
13 int b = *aaa;
14 int c = b != 0;
15 int d = t != 0;
16 if (d | c)
17 return 0;
18 for(int i = 0; i < j; i++)
19 {
20 if (*aaa) foo();
21 }
22 return 0;
23 }
24
25 int f1(int *aaa, int j, int t)
26 {
27 int b = *aaa;
28 if (b != 0 || t != 0)
29 return 0;
30 for(int i = 0; i < j; i++)
31 {
32 if (*aaa) foo();
33 }
34 return 0;
35 }
36
37
38 int f2(int *aaa, int j, int t)
39 {
40 int b = *aaa;
41 if (b != 0)
42 return 0;
43 if (t != 0)
44 return 0;
45 for(int i = 0; i < j; i++)
46 {
47 if (*aaa) foo();
48 }
49 return 0;
50 }
51
52 /* { dg-final { scan-tree-dump-not "foo " "optimized" } } */
53 /* { dg-final { scan-tree-dump "return 0;" "optimized" } } */