1 /* Verify that IPA-CP can make edges direct based on aggregate contents.  */
2 /* { dg-do compile } */
3 /* { dg-options "-O3 -fno-early-inlining -fdump-ipa-cp -fdump-ipa-inline"  } */
4 
5 struct S
6 {
7   int i;
8   void (*f)(struct S *);
9   unsigned u;
10 };
11 
12 struct U
13 {
14   struct U *next;
15   struct S s;
16   short a[8];
17 };
18 
19 extern void non_existent(struct S *p, int);
20 
hooray1(struct S * p)21 static void hooray1 (struct S *p)
22 {
23   non_existent (p, 1);
24 }
25 
26 static __attribute__ ((noinline))
hiphip1(struct S * p)27 void hiphip1 (struct S *p)
28 {
29   p->f (p);
30 }
31 
test1(void)32 int test1 (void)
33 {
34   struct S s;
35   s.i = 1234;
36   s.f = hooray1;
37   s.u = 1001;
38   hiphip1 (&s);
39   return 0;
40 }
41 
42 /* { dg-final { scan-ipa-dump "ipa-prop: Discovered an indirect call to a known target"  "cp"  } } */
43 /* { dg-final { scan-ipa-dump "hooray1\[^\\n\]*inline copy in hiphip1"  "inline"  } } */
44