diff options
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/devirt-42.C | 10 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/devirt-44.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/devirt-45.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/devirt-46.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/devirt-47.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/devirt-48.C | 32 |
7 files changed, 46 insertions, 11 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b3921d61f30..bd7055c5372 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2014-10-04 Jan Hubicka <hubicka@ucw.cz> + + * g++.dg/ipa/devirt-42.C: Update template. + * g++.dg/ipa/devirt-44.C: Update template. + * g++.dg/ipa/devirt-45.C: Update template. + * g++.dg/ipa/devirt-46.C: Update template. + * g++.dg/ipa/devirt-47.C: Update template. + * g++.dg/ipa/devirt-48.C: New testcase. + 2014-10-02 Mark Wielaard <mjw@redhat.com> PR debug/63239 diff --git a/gcc/testsuite/g++.dg/ipa/devirt-42.C b/gcc/testsuite/g++.dg/ipa/devirt-42.C index 40076ddf33e..e5544eff598 100644 --- a/gcc/testsuite/g++.dg/ipa/devirt-42.C +++ b/gcc/testsuite/g++.dg/ipa/devirt-42.C @@ -26,13 +26,9 @@ main() /* Inlining everything into main makes type clear from type of variable b. However devirtualization is also possible for offline copy of A::barbar. Invoking B's barbar makes it clear the type is at least B and B is an anonymous - namespace type and therefore we know it has no derivations. - FIXME: Currently we devirtualize speculatively only because we do not track - dynamic type changes well. */ -/* { dg-final { scan-ipa-dump-times "First type is base of second" 1 "inline" } } */ -/* { dg-final { scan-ipa-dump-times "Outer types match, merging flags" 2 "inline" } } */ -/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "inline" } } */ -/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a speculative target" 1 "inline" } } */ + namespace type and therefore we know it has no derivations. */ +/* { dg-final { scan-ipa-dump-times "First type is base of second" 3 "inline" } } */ +/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 2 "inline" } } */ /* Verify that speculation is optimized by late optimizers. */ /* { dg-final { scan-ipa-dump-times "return 2" 2 "optimized" } } */ diff --git a/gcc/testsuite/g++.dg/ipa/devirt-44.C b/gcc/testsuite/g++.dg/ipa/devirt-44.C index 4f6ab30cb02..bd6c198d831 100644 --- a/gcc/testsuite/g++.dg/ipa/devirt-44.C +++ b/gcc/testsuite/g++.dg/ipa/devirt-44.C @@ -27,7 +27,6 @@ main() Check that we handle that. */ /* { dg-final { scan-ipa-dump-times "First type is base of second" 1 "inline" } } */ -/* { dg-final { scan-ipa-dump "(maybe in construction)" "inline" } } */ /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target\[^\\n\]*A::foo" 1 "inline" } } */ /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target\[^\\n\]*B::foo" 1 "inline" } } */ /* { dg-final { cleanup-ipa-dump "inline" } } */ diff --git a/gcc/testsuite/g++.dg/ipa/devirt-45.C b/gcc/testsuite/g++.dg/ipa/devirt-45.C index 2158c7e5987..5c47e080bf5 100644 --- a/gcc/testsuite/g++.dg/ipa/devirt-45.C +++ b/gcc/testsuite/g++.dg/ipa/devirt-45.C @@ -37,7 +37,6 @@ main() } /* One invocation is A::foo () other is B::foo () even though the type is destroyed and rebuilt in test() */ -/* { dg-final { scan-ipa-dump "(maybe in construction)" "inline" } } */ /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target\[^\\n\]*A::foo" 1 "inline" } } */ /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target\[^\\n\]*B::foo" 1 "inline" } } */ /* { dg-final { cleanup-ipa-dump "inline" } } */ diff --git a/gcc/testsuite/g++.dg/ipa/devirt-46.C b/gcc/testsuite/g++.dg/ipa/devirt-46.C index a6da9c9f62b..2648fa9cf3a 100644 --- a/gcc/testsuite/g++.dg/ipa/devirt-46.C +++ b/gcc/testsuite/g++.dg/ipa/devirt-46.C @@ -20,7 +20,7 @@ m() return 0; } -/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a speculative target\[^\\n\]*B::foo" 1 "inline" } } */ +/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target\[^\\n\]*B::foo" 1 "inline" } } */ /* { dg-final { scan-ipa-dump-not "OBJ_TYPE_REF" "optimized" } } */ /* { dg-final { scan-ipa-dump-not "abort" "optimized" } } */ /* { dg-final { cleanup-ipa-dump "inline" } } */ diff --git a/gcc/testsuite/g++.dg/ipa/devirt-47.C b/gcc/testsuite/g++.dg/ipa/devirt-47.C index 85f7b634342..364a9ab085e 100644 --- a/gcc/testsuite/g++.dg/ipa/devirt-47.C +++ b/gcc/testsuite/g++.dg/ipa/devirt-47.C @@ -23,7 +23,7 @@ m() return 0; } -/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a speculative target\[^\\n\]*C::_ZTh" 1 "inline" } } */ +/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target\[^\\n\]*C::_ZTh" 1 "inline" } } */ /* { dg-final { scan-ipa-dump-not "OBJ_TYPE_REF" "optimized" } } */ /* FIXME: We ought to inline thunk. */ /* { dg-final { scan-ipa-dump "C::_ZThn" "optimized" } } */ diff --git a/gcc/testsuite/g++.dg/ipa/devirt-48.C b/gcc/testsuite/g++.dg/ipa/devirt-48.C new file mode 100644 index 00000000000..e1ed27477a0 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/devirt-48.C @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fno-ipa-cp -fdump-ipa-inline-details -fno-early-inlining" } */ +struct A { + virtual int foo(){return 1;} +}; +struct B:A { + virtual int foo(){return 2;} + int callfoo(){foo();} +}; +struct C:A { + virtual int foo(){return 3;} +}; +struct D:B { + virtual int foo(){return 4;} + int callfoo(){foo();} +}; +static void +test (struct A *a) +{ + if (a->foo() != 2) + __builtin_abort (); +} +int +m() +{ + struct A *a = new C; + static_cast<B*>(a)->callfoo(); + return 0; +} + +/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target\[^\\n\]*__builtin_unreachable" 1 "inline" } } */ +/* { dg-final { cleanup-ipa-dump "inline" } } */ |