1 /* Verify that IPA-CP can do devirtualization even if the virtual call
2 comes from a method that has been early-inlined into a descendant. */
4 /* { dg-options "-O3 -fdump-ipa-cp" } */
6 extern "C" void abort (void);
18 virtual float bar (float z);
25 virtual int foo (int i);
26 int middleman_1 (int i);
30 class B : public Distraction, public A
33 virtual int foo (int i);
34 int middleman_2 (int i);
35 __attribute__ ((noinline)) B();
38 float Distraction::bar (float z)
54 int __attribute__ ((noinline,noclone)) get_input(void)
59 int inline __attribute__ ((always_inline))
60 A::middleman_1 (int i)
65 int __attribute__ ((noinline))
66 B::middleman_2 (int i)
68 return this->middleman_1 (i);
75 int main (int argc, char *argv[])
80 for (i = 0; i < get_input(); i++)
81 if (b.middleman_2 (get_input ()) != 3)
86 /* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*B::foo" "cp" } } */
87 /* { dg-final { cleanup-ipa-dump "cp" } } */