1 /* { dg-do compile } */ 2 /* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */ 3 4 static int 5 __attribute__((noinline)) ox(int * i)6ox (int *i) 7 { 8 return *i+4**i; 9 } 10 11 int *holder; 12 13 static int 14 __attribute__((noinline)) ox_ctrl_1(int * j)15ox_ctrl_1 (int *j) 16 { 17 holder = j; 18 return *j+4 * *j+1; 19 } 20 21 static void 22 __attribute__((noinline)) ox_ctrl_2(int * k)23ox_ctrl_2 (int *k) 24 { 25 *k = 8; 26 } 27 28 static int zzz[10]; 29 30 static int 31 __attribute__((noinline)) ox_improved(int recurse,int * l)32ox_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 caller(void)51void 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-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" } } */ 68