aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-prop.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2013-09-23 18:54:34 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2013-09-23 16:54:34 +0000
commit450ad0cd441aa2da250c2ca84e8005cb3a2d38e3 (patch)
treeaa313df8c645e4e1d249c3df18ae10900ad40a7e /gcc/ipa-prop.c
parentdfff7c46929d43dac828cd232c231dcb5bd7653a (diff)
downloadgcc-450ad0cd441aa2da250c2ca84e8005cb3a2d38e3.zip
gcc-450ad0cd441aa2da250c2ca84e8005cb3a2d38e3.tar.gz
gcc-450ad0cd441aa2da250c2ca84e8005cb3a2d38e3.tar.bz2
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
Diffstat (limited to 'gcc/ipa-prop.c')
-rw-r--r--gcc/ipa-prop.c14
1 files changed, 13 insertions, 1 deletions
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;
}