1 /* Verify that ipa-cp correctly detects the dynamic type of an object
2 under construction when doing devirtualization. */
4 /* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized" } */
6 extern "C" void abort (void);
13 virtual int foo (int i);
20 virtual int foo (int i);
26 virtual int foo (int i);
44 static int __attribute__ ((noinline))
45 middleman (class A *obj, int i)
50 int __attribute__ ((noinline,noclone)) get_input(void)
55 inline __attribute__ ((always_inline)) A::A ()
57 if (middleman (this, get_input ()) != 2)
61 inline __attribute__ ((always_inline)) B::B ()
70 int main (int argc, char *argv[])
74 for (i = 0; i < 10; i++)
79 /* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*A::foo" "cp" } } */
80 /* { dg-final { scan-tree-dump-times "OBJ_TYPE_REF" 0 "optimized"} } */