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" } */
5 /* { dg-add-options bind_pic_locally } */
7 extern "C" void abort (void);
19 virtual float bar (float z);
26 virtual int foo (int i);
27 int middleman_1 (int i);
31 class B : public Distraction, public A
34 virtual int foo (int i);
35 int middleman_2 (int i);
36 __attribute__ ((noinline)) B();
39 float Distraction::bar (float z)
55 int __attribute__ ((noinline,noclone)) get_input(void)
60 int inline __attribute__ ((always_inline))
61 A::middleman_1 (int i)
66 int __attribute__ ((noinline))
67 B::middleman_2 (int i)
69 return this->middleman_1 (i);
76 int main (int argc, char *argv[])
81 for (i = 0; i < get_input(); i++)
82 if (b.middleman_2 (get_input ()) != 3)
87 /* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*B::foo" "cp" } } */
88 /* { dg-final { cleanup-ipa-dump "cp" } } */