1 /* Verify that ipa-cp can convert simple virtual calls to a direct
2 ones even when a typecast to an ancestor is involved along the way
3 and that ancestor is not the first one with virtual functions. */
5 /* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized" } */
7 extern "C" void abort (void);
19 virtual float bar (float z);
26 virtual int foo (int i);
30 class B : public Distraction, public A
33 virtual int foo (int i);
36 float Distraction::bar (float z)
52 int __attribute__ ((noinline,noclone)) get_input(void)
57 static int middleman_1 (class A *obj, int i)
62 static int middleman_2 (class B *obj, int i)
64 return middleman_1 (obj, i);
67 int main (int argc, char *argv[])
71 if (middleman_2 (&b, get_input ()) != 3)
76 /* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*B::foo" "cp" } } */
77 /* { dg-final { scan-tree-dump-times "OBJ_TYPE_REF" 0 "optimized"} } */
78 /* { dg-final { cleanup-ipa-dump "cp" } } */
79 /* { dg-final { cleanup-tree-dump "optimized" } } */