Debian Codegraph @

gcc/testsuite/gcc.dg/ipa/ipa-sra-13.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fipa-sra -fdump-ipa-sra" } */
3
4 /* Check of a by-reference structure split. */
5
6 struct S
7 {
8 float red;
9 void *blue;
10 int green;
11 };
12
13 void __attribute__((noipa))
14 check (float r, int g, int g2)
15 {
16 if (r < 7.39 || r > 7.41
17 || g != 6 || g2 != 6)
18 __builtin_abort ();
19 }
20
21 static void
22 __attribute__((noinline))
23 foo (struct S *s)
24 {
25 check (s->red, s->green, s->green);
26 }
27
28 static void
29 __attribute__((noinline))
30 bar (struct S *s)
31 {
32 foo (s);
33 }
34
35 int
36 main (int argc, char **argv)
37 {
38 struct S s;
39
40 s.red = 7.4;
41 s.green = 6;
42 s.blue = &s;
43
44 bar (&s);
45 return 0;
46 }
47
48 /* { dg-final { scan-ipa-dump-times "Will split parameter" 2 "sra" } } */
49 /* { dg-final { scan-ipa-dump-times "component at byte offset" 4 "sra" } } */