Debian Codegraph @

gcc/testsuite/g++.dg/tree-ssa/restrict2.C

raw
1 // { dg-do compile }
2 // { dg-options "-O2 -fdump-tree-optimized" }
3
4 struct S { int *__restrict p; int q; };
5 S s;
6
7 int
8 f1 (S x, S y)
9 {
10 x.p[0] = 1;
11 y.p[0] = 0;
12 // { dg-final { scan-tree-dump-times "return 1" 1 "optimized" } }
13 return x.p[0];
14 }
15
16 int
17 f2 (S x)
18 {
19 x.p[0] = 2;
20 s.p[0] = 0;
21 // { dg-final { scan-tree-dump-times "return 2" 1 "optimized" } }
22 return x.p[0];
23 }
24
25 int
26 f3 (S &__restrict x, S &__restrict y)
27 {
28 x.p[0] = 3;
29 y.p[0] = 0;
30 // { dg-final { scan-tree-dump-times "return 3" 1 "optimized" } }
31 return x.p[0];
32 }
33
34 int
35 f4 (S &x, S &y)
36 {
37 x.p[0] = 4;
38 y.p[0] = 0;
39 // { dg-final { scan-tree-dump-times "return 4" 0 "optimized" } }
40 return x.p[0];
41 }
42
43 int
44 f5 (S *__restrict x, S *__restrict y)
45 {
46 x->p[0] = 5;
47 y->p[0] = 0;
48 // { dg-final { scan-tree-dump-times "return 5" 1 "optimized" } }
49 return x->p[0];
50 }
51
52 int
53 f6 (S *x, S *y)
54 {
55 x->p[0] = 6;
56 y->p[0] = 0;
57 // { dg-final { scan-tree-dump-times "return 6" 0 "optimized" } }
58 return x->p[0];
59 }
60