1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-ipa-devirt"  } */
tA3 struct A {virtual int t(){return 42;}};
tB4 struct B:A {virtual int t(){return 1;}};
5 
6 struct A aa;
7 struct B bb;
8 int
t(struct B * b)9 t(struct B *b)
10 {
11   struct A *a=b;
12   a->t();
13 
14   return 0;
15 }
16 
17 /* We should guess that the pointer of type B probably points to an instance
18    of B or its derivates and exclude A::t from list of likely targets.  */
19 
20 /* { dg-final { scan-ipa-dump "Speculative targets"  "devirt"  } } */
21 /* { dg-final { scan-ipa-dump "1 speculatively devirtualized"  "devirt"  } } */
22