aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-07-30 09:48:13 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2014-07-30 07:48:13 +0000
commita0fd33735af6e5694238563a8ab40be029060660 (patch)
treebb01706109f71a5e58004af1b340b038a77eb8d7 /gcc/testsuite
parentbb3ec3881ef26805aa0b9a58b871004d25cca9bc (diff)
downloadgcc-a0fd33735af6e5694238563a8ab40be029060660.zip
gcc-a0fd33735af6e5694238563a8ab40be029060660.tar.gz
gcc-a0fd33735af6e5694238563a8ab40be029060660.tar.bz2
devirt-34.C: New testcase.
* g++.dg/ipa/devirt-34.C: New testcase. * ipa-devirt.c (polymorphic_call_target_d): Rename nonconstruction_targets to speculative_targets (get_class_context): Fix handling of contextes without outer type; avoid matching non-polymorphic types in LTO. (possible_polymorphic_call_targets): Trun nonconstruction_targetsp parameter to speculative_targetsp; handle speculation. (dump_possible_polymorphic_call_targets): Update dumping. From-SVN: r213232
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-34.C17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-34.C b/gcc/testsuite/g++.dg/ipa/devirt-34.C
new file mode 100644
index 0000000..258a2ad
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/devirt-34.C
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-devirt" } */
+struct A {virtual int t(){return 42;}};
+struct B:A {virtual int t(){return 1;}};
+int
+t(struct B *b)
+{
+ struct A *a=b;
+ a->t();
+}
+
+/* We should guess that the pointer of type B probably points to an instance
+ of B or its derivates and exclude A::t from list of likely targets. */
+
+/* { dg-final { scan-ipa-dump "Targets that are not likely" "devirt" } } */
+/* { dg-final { scan-ipa-dump "1 speculatively devirtualized" "devirt" } } */
+/* { dg-final { cleanup-ipa-dump "devirt" } } */