aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-07-06 13:44:34 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2010-07-06 11:44:34 +0000
commit6e4da08400087856425b00d401d0232cbe1bb729 (patch)
treef61a95301d024ed9b39eeb35adfa978e722ded91 /gcc
parentebeb2c24db1596f623b3b421f9172deea0d35194 (diff)
downloadgcc-6e4da08400087856425b00d401d0232cbe1bb729.zip
gcc-6e4da08400087856425b00d401d0232cbe1bb729.tar.gz
gcc-6e4da08400087856425b00d401d0232cbe1bb729.tar.bz2
gimple-fold.c (gimple_fold_obj_type_ref_known_binfo): Check that function is still available to fold into.
* gimple-fold.c (gimple_fold_obj_type_ref_known_binfo): Check that function is still available to fold into. From-SVN: r161866
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gimple-fold.c11
2 files changed, 15 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 156b55a..59455aa 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-05 Jan Hubicka <jh@suse.cz>
+
+ * gimple-fold.c (gimple_fold_obj_type_ref_known_binfo): Check that
+ function is still available to fold into.
+
2010-07-05 Nathan Froyd <froydnj@codesourcery.com>
* vec.h (FOR_EACH_VEC_ELT_REVERSE): New macro.
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 6af6511..659102b 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -1156,7 +1156,7 @@ gimple_fold_builtin (gimple stmt)
fold_convert (TREE_TYPE (gimple_call_lhs (stmt)), val[0]);
/* If the result is not a valid gimple value, or not a cast
- of a valid gimple value, then we can not use the result. */
+ of a valid gimple value, then we cannot use the result. */
if (is_gimple_val (new_val)
|| (is_gimple_cast (new_val)
&& is_gimple_val (TREE_OPERAND (new_val, 0))))
@@ -1351,6 +1351,7 @@ gimple_fold_obj_type_ref_known_binfo (HOST_WIDE_INT token, tree known_binfo)
{
HOST_WIDE_INT i;
tree v, fndecl;
+ struct cgraph_node *node;
v = BINFO_VIRTUALS (known_binfo);
i = 0;
@@ -1362,6 +1363,14 @@ gimple_fold_obj_type_ref_known_binfo (HOST_WIDE_INT token, tree known_binfo)
}
fndecl = TREE_VALUE (v);
+ node = cgraph_get_node (fndecl);
+ /* When cgraph node is missing and function is not public, we cannot
+ devirtualize. This can happen in WHOPR when the actual method
+ ends up in other partition, because we found devirtualization
+ possibility too late. */
+ if ((!node || !node->analyzed)
+ && (!TREE_PUBLIC (fndecl) || DECL_COMDAT (fndecl)))
+ return NULL;
return build_fold_addr_expr (fndecl);
}