aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-08-15 01:36:22 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2014-08-14 23:36:22 +0000
commit80b6ba28787d32f5ca63d9a643c110474ba79160 (patch)
treef6a1bda569f302e135bad3e65c640895625724a3
parent56b1f114de93c27600b9b295ff7efcf9caedfc72 (diff)
downloadgcc-80b6ba28787d32f5ca63d9a643c110474ba79160.zip
gcc-80b6ba28787d32f5ca63d9a643c110474ba79160.tar.gz
gcc-80b6ba28787d32f5ca63d9a643c110474ba79160.tar.bz2
re PR tree-optimization/62091 (ice in before_dom_children)
PR tree-optimization/62091 * g++.dg/ipa/devirt-38.C: New testcase. * tree-ssa-alias.c (walk_aliased_vdefs_1): Do not clear function_entry_reached. (walk_aliased_vdefs): Clear it here. * ipa-devirt.c (check_stmt_for_type_change): Handle static storage. From-SVN: r213991
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/ipa-devirt.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-38.C30
-rw-r--r--gcc/tree-ssa-alias.c5
5 files changed, 48 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 223e484..e5e0852 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2014-08-14 Jan Hubicka <hubicka@ucw.cz>
+ PR tree-optimization/62091
+ * tree-ssa-alias.c (walk_aliased_vdefs_1): Do not clear
+ function_entry_reached.
+ (walk_aliased_vdefs): Clear it here.
+ * ipa-devirt.c (check_stmt_for_type_change): Handle static storage.
+
+2014-08-14 Jan Hubicka <hubicka@ucw.cz>
+
* ipa-utils.h (compare_virtual_tables): Declare.
* ipa-devirt.c (odr_subtypes_equivalent_p): New function
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 2d356ad..ff206ee 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -2777,6 +2777,8 @@ check_stmt_for_type_change (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef, void *data)
* BITS_PER_UNIT;
op = TREE_OPERAND (op, 0);
}
+ else if (DECL_P (op))
+ ;
else
{
tci->speculative = true;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bc879c1..73a6ab8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-08-14 Jan Hubicka <hubicka@ucw.cz>
+
+ PR tree-optimization/62091
+ * g++.dg/ipa/devirt-38.C: New testcase.
+
2014-08-14 Marek Polacek <polacek@redhat.com>
DR 458
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-38.C b/gcc/testsuite/g++.dg/ipa/devirt-38.C
new file mode 100644
index 0000000..be8cbdf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/devirt-38.C
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+class SnmpSyntax
+{
+public:
+ virtual SnmpSyntax *m_fn1 () const;
+ ~SnmpSyntax () {}
+ virtual SnmpSyntax &operator=(const SnmpSyntax &);
+};
+
+class A : public SnmpSyntax
+{
+public:
+ A (int);
+ SnmpSyntax *m_fn1 () const {}
+ SnmpSyntax &operator=(const SnmpSyntax &);
+};
+int a;
+void fn1 ()
+{
+ for (;; a++)
+ switch (0)
+ case 0:
+ {
+ A b (0);
+ SnmpSyntax &c = b;
+ c.m_fn1 ();
+ }
+}
+// Devirtualization to A::m_fn1 would be possible, but we can not do it at the moment
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 2910374..67419a9 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -2658,8 +2658,6 @@ walk_aliased_vdefs_1 (ao_ref *ref, tree vdef,
bitmap *visited, unsigned int cnt,
bool *function_entry_reached)
{
- if (function_entry_reached)
- *function_entry_reached = false;
do
{
gimple def_stmt = SSA_NAME_DEF_STMT (vdef);
@@ -2709,6 +2707,9 @@ walk_aliased_vdefs (ao_ref *ref, tree vdef,
timevar_push (TV_ALIAS_STMT_WALK);
+ if (function_entry_reached)
+ *function_entry_reached = false;
+
ret = walk_aliased_vdefs_1 (ref, vdef, walker, data,
visited ? visited : &local_visited, 0,
function_entry_reached);