summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ipa
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-19 11:42:30 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-19 11:42:30 +0000
commitb307cdec4c2432db7b868d3c5cc86a2ef9a4eaac (patch)
treeb4a6cf8d09ece86719d87f79f3bcfca0c7c4a6da /gcc/testsuite/g++.dg/ipa
parent553c730265fbaace4c46d760297f315c2ca87cf9 (diff)
downloadgcc-b307cdec4c2432db7b868d3c5cc86a2ef9a4eaac.tar.gz
PR tree-optimization/55683
* g++.dg/ipa/devirt-9.C: New testcase. * ipa-prop.c (try_make_edge_direct_virtual_call): Look into constants for binfo. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194606 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg/ipa')
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-9.C30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-9.C b/gcc/testsuite/g++.dg/ipa/devirt-9.C
new file mode 100644
index 00000000000..62ea96e5eed
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/devirt-9.C
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-inline" } */
+double foo ();
+struct B
+{
+ bool b1 () { return b3 (); }
+ void b2 ();
+ virtual bool b3 ();
+};
+struct C
+{
+ C () {}
+ bool
+ c1 (float x, float y)
+ {
+ if (x != c3 || y != c4)
+ c2.b2 ();
+ return c2.b1 ();
+ }
+ B c2;
+ float c3, c4;
+};
+
+void
+bar ()
+{
+ static C c;
+ c.c1 (60, (int) foo ());
+}
+/* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target" "inline" } } */