2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / ipa-sra-4.c
blob50ac179b22597af4d1d98bcf3199da9fc5b57858
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
4 static int
5 __attribute__((noinline))
6 ox (int *i)
8 return *i+4**i;
11 int *holder;
13 static int
14 __attribute__((noinline))
15 ox_ctrl_1 (int *j)
17 holder = j;
18 return *j+4 * *j+1;
21 static void
22 __attribute__((noinline))
23 ox_ctrl_2 (int *k)
25 *k = 8;
28 static int zzz[10];
30 static int
31 __attribute__((noinline))
32 ox_improved (int recurse, int *l)
34 int r = 0;
36 r = *l;
38 if (recurse)
40 if (recurse > 2)
41 l = &zzz[3];
42 else
43 l = zzz;
45 ox_improved (0, l);
48 return r;
51 void caller (void)
53 int a = 1;
54 int b = 10;
55 int c;
57 ox (&a);
58 ox_ctrl_1 (&a);
59 ox_ctrl_2 (&a);
60 *holder = ox_improved (1, &b);
61 return;
64 /* { dg-final { scan-tree-dump "About to replace expr \\*i_.*D. with ISRA" "eipa_sra" } } */
65 /* { dg-final { scan-tree-dump "About to replace expr \\*l_.*D. with ISRA" "eipa_sra" } } */
66 /* { dg-final { scan-tree-dump-times "About to replace expr \*j_.*D. with ISRA" 0 "eipa_sra" } } */
67 /* { dg-final { scan-tree-dump-times "About to replace expr \*k_.*D. with ISRA" 0 "eipa_sra" } } */