tree-pass.h (TODO_remove_unused_locals): Define.
[gcc.git] / gcc / testsuite / g++.dg / tree-ssa / ssa-sra-1.C
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-optimized" } */
3
4 void link_error();
5
6
7 struct State {
8 int p0, p1, p2;
9 inline State(){p0=0;p1=0;p2=0;}
10 inline State(const State &s) {
11 p0 = s.p0;
12 p1 = s.p1;
13 p2 = s.p2;
14 }
15
16 inline void operator =(const State &s) {
17 p0 = s.p0;
18 p1 = s.p1;
19 p2 = s.p2;
20 }
21
22 inline void step(void) {
23 p0 = p1+p2;
24 p1 = p0*p1+p2;
25 p2 = p0-p2;
26 }
27 };
28
29
30 inline void iterate_ok(State &inS1, State &inS2, unsigned int n)
31 {
32 State s1 = inS1;
33 for (unsigned int i = 0; i < n; i++) {
34 s1.step();
35 }
36 inS1 = s1;
37 }
38
39 void temp()
40 {
41 State s1;
42 s1.p0 = 0;
43 s1.p1 = 0;
44 s1.p2 = 0;
45 State s2;
46 s2.p0 = 0;
47 s2.p1 = 0;
48 s2.p2 = 0;
49 iterate_ok (s1, s2, 1);
50 if (s1.p0)
51 link_error();
52 if (s1.p0)
53 link_error();
54 if (s1.p0)
55 link_error();
56 }
57
58 /* We should have removed the casts from pointers to references and caused SRA to happen. */
59
60 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */
61 /* { dg-final { cleanup-tree-dump "optimized" } } */