1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-ipa-sra" } */
3
4 struct S
5 {
6 long a, b;
7 };
8
9 extern void leaf_a (int );
10 extern void leaf_b (int, int);
11 extern void leaf_c (int, int);
12
13 extern void leaf_sa (struct S);
14
15 static void baz (int i, int j, int k, int l, struct S a, struct S b);
16
17 extern int gi;
18
19 static void __attribute__((noinline))
foo(int i,int j,int k,int l,struct S a,struct S b)20 foo (int i, int j, int k, int l, struct S a, struct S b)
21 {
22 gi += l;
23 baz (i, j, k, l, a, b);
24 }
25
26 static void __attribute__((noinline))
bar(int i,int j,int k,int l,struct S a,struct S b)27 bar (int i, int j, int k, int l, struct S a, struct S b)
28 {
29 foo (i, j, k, l, a, b);
30 leaf_sa (b);
31 }
32
33
34 static void __attribute__((noinline))
baz(int i,int j,int k,int l,struct S a,struct S b)35 baz (int i, int j, int k, int l, struct S a, struct S b)
36 {
37 if (--k)
38 bar (i, j, k, l, a, b);
39 leaf_b (i, k);
40 }
41
42 void
entry(int i,int j,int k,int l,struct S a,struct S b)43 entry (int i, int j, int k, int l, struct S a, struct S b)
44 {
45 foo (i, j, k, l, a, b);
46 }
47
48 /* { dg-final { scan-ipa-dump-times "Will remove parameter 1" 3 "sra" } } */
49 /* { dg-final { scan-ipa-dump-times "Will remove parameter 4" 3 "sra" } } */
50