OSDN Git Service

Add missing test from last commit
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / tree-ssa / copyprop-1.C
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-dce2" } */
3
4 /* Verify that we can eliminate the useless conversions to/from
5    const qualified pointer types
6      this_2 = o_1;
7      D.20003_4 = this_2->data_m;
8      this_5 = D.20003_4;
9      D.20005_6 = this_5->value;
10    copyprop should propagate o_1 and D.20003_4 to the loads of data_m
11    and value.  dce removes all traces of this.  */
12
13 struct Data {
14   int get() const { return value; }
15   int value;
16 };
17
18 struct Object {
19   int operator[](int i) const { return data_m->get(); }
20   Data *data_m;
21 };
22
23 int foo(Object&o)
24 {
25   return o[0];
26 }
27
28 /* { dg-final { scan-tree-dump-not ".* = \[^>;\]*;" "dce2" { xfail *-*-* } } } */
29 /* { dg-final { cleanup-tree-dump "dce2" } } */