Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / testsuite / g++.dg / tree-ssa / copyprop-1.C
blob2be046915378e7308334105a6cbc284f0be89156
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-dce2" } */
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.  */
13 struct Data {
14   int get() const { return value; }
15   int value;
18 struct Object {
19   int operator[](int i) const { return data_m->get(); }
20   Data *data_m;
23 int foo(Object&o)
25   return o[0];
28 /* { dg-final { scan-tree-dump-not ".* = \[^>;\]*;" "dce2" } } */
29 /* { dg-final { cleanup-tree-dump "dce2" } } */