OSDN Git Service

PR c++/46124
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / ipa / devirt-g-1.C
1 // { dg-do compile }
2 // { dg-options "-O2 -fdump-ipa-cp -fdump-tree-optimized" }
3
4 struct S { S(); virtual void xyzzy(); void otherstuff(); };
5 struct R { int a; S s; R(); };
6 S s;
7 R r;
8
9 void S::xyzzy ()
10 {
11   otherstuff ();
12   otherstuff ();
13 }
14
15 static void __attribute__ ((noinline)) foo(S *p) { p->xyzzy(); }
16 void bar() {foo(&s); }
17
18 static void __attribute__ ((noinline)) foh(S *p) { p->xyzzy(); }
19 void bah() {foh(&r.s); }
20
21 /* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*S::xyzzy" "cp"  } } */
22 /* { dg-final { scan-tree-dump-times "OBJ_TYPE_REF" 0 "optimized"} } */
23 /* { dg-final { cleanup-ipa-dump "cp" } } */
24 /* { dg-final { cleanup-tree-dump "optimized" } } */