1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-lim2-details" } */
3
4 int x;
5 int a[100];
6
7 struct a
8 {
9 int X;
10 int Y;
11 };
12
13 void bla(void);
14
test1(void)15 void test1(void)
16 {
17 unsigned i;
18
19 /* We should perform store motion here. */
20 for (x = 0; x < 100; x++)
21 a[x] = x;
22 }
23
test2(void)24 void test2(void)
25 {
26 unsigned i;
27
28 /* But not here. */
29 for (x = 0; x < 100; x++)
30 bla ();
31 }
32
test3(struct a * A)33 void test3(struct a *A)
34 {
35 unsigned i;
36
37 /* But we should here (using base + offset analysis). */
38 for (i = 0; i < 100; i++)
39 {
40 A[5].X += i;
41 A[5].Y += i;
42 }
43 }
44
45 /* { dg-final { scan-tree-dump-times "Executing store motion of" 3 "lim2" } } */
46