1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fipa-sra -fno-ipa-pure-const -fdump-ipa-sra -fno-ipa-modref" } */
3
4 static int
5 __attribute__((noinline))
6 ox (int *i)
7 {
8 return *i+4**i;
9 }
10
11 int *holder;
12
13 static int
14 __attribute__((noinline))
15 ox_ctrl_1 (int *j)
16 {
17 holder = j;
18 return *j+4 * *j+1;
19 }
20
21 static void
22 __attribute__((noinline))
23 ox_ctrl_2 (int *k)
24 {
25 *k = 8;
26 }
27
28 static int zzz[10];
29
30 static int
31 __attribute__((noinline))
32 ox_improved (int recurse, int *l)
33 {
34 int r = 0;
35
36 r = *l;
37
38 if (recurse)
39 {
40 if (recurse > 2)
41 l = &zzz[3];
42 else
43 l = zzz;
44
45 ox_improved (0, l);
46 }
47
48 return r;
49 }
50
51 void caller (void)
52 {
53 int a = 1;
54 int b = 10;
55 int c;
56
57 ox (&a);
58 ox_ctrl_1 (&a);
59 ox_ctrl_2 (&a);
60 *holder = ox_improved (1, &b);
61 return;
62 }
63
64 /* { dg-final { scan-ipa-dump-times "Will split parameter" 2 "sra" } } */
65