re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr17598.c
1 /* { dg-do compile } */
2 /* { dg-options "-fdump-tree-gimple" } */
3
4 struct f
5 {
6 int i;
7 int j;
8 };
9
10 struct g
11 {
12 int i;
13 struct f j;
14 struct f *k;
15 };
16
17 int foo(struct f *x, struct f *y)
18 {
19 return &x->j == &y->j; /* x == y */
20 }
21
22 struct f y;
23 int bar(struct f *x)
24 {
25 return &x->j == &y.j; /* x == &y */
26 }
27
28 struct g yy;
29 int foobar(struct g *x)
30 {
31 return &x->j.i == &yy.j.i; /* x == &yy */
32 }
33 int foobar2(struct g *x)
34 {
35 return &x->k->i == &yy.k->i; /* x->k == yy.k */
36 }
37
38 /* { dg-final { scan-tree-dump-times "x == y" 1 "gimple" } } */
39 /* { dg-final { scan-tree-dump-times "x == &y" 2 "gimple" } } */
40 /* { dg-final { scan-tree-dump "x->k" "gimple" } } */
41 /* { dg-final { scan-tree-dump "yy.k" "gimple" } } */
42 /* { dg-final { cleanup-tree-dump "gimple" } } */