From 450ad0cd441aa2da250c2ca84e8005cb3a2d38e3 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 23 Sep 2013 18:54:34 +0200 Subject: ipa-cp.c (ipa_get_indirect_edge_target_1): Add sanity check for ipa-devirt. * ipa-cp.c (ipa_get_indirect_edge_target_1): Add sanity check for ipa-devirt. * ipa-utils.h (possible_polymorphic_call_target_p): New function. * ipa-devirt.c (possible_polymorphic_call_target_p): Be tolerant of external calls * gimple-fold.c: Include ipa-utils.h and gimple-pretty-print.h (gimple_fold_call): Dump inconsistent devirtualizations; add sanity check for type based devirtualizations. * ipa-prop.c: Include ipa-utils.h (ipa_intraprocedural_devirtualization): Add sanity check. (try_make_edge_direct_virtual_call): Likewise. From-SVN: r202837 --- gcc/ipa-prop.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'gcc/ipa-prop.c') diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index c09ec2f..2fbc9d4 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see #include "data-streamer.h" #include "tree-streamer.h" #include "params.h" +#include "ipa-utils.h" /* Intermediate information about a parameter that is only useful during the run of ipa_analyze_node and is not kept afterwards. */ @@ -2196,6 +2197,11 @@ ipa_intraprocedural_devirtualization (gimple call) token = OBJ_TYPE_REF_TOKEN (otr); fndecl = gimple_get_virt_method_for_binfo (tree_low_cst (token, 1), binfo); +#ifdef ENABLE_CHECKING + if (fndecl) + gcc_assert (possible_polymorphic_call_target_p + (otr, cgraph_get_node (fndecl))); +#endif return fndecl; } @@ -2651,7 +2657,13 @@ try_make_edge_direct_virtual_call (struct cgraph_edge *ie, return NULL; if (target) - return ipa_make_edge_direct_to_target (ie, target); + { +#ifdef ENABLE_CHECKING + gcc_assert (possible_polymorphic_call_target_p + (ie, cgraph_get_node (target))); +#endif + return ipa_make_edge_direct_to_target (ie, target); + } else return NULL; } -- cgit v1.1