summaryrefslogtreecommitdiff
path: root/gcc/ipa-polymorphic-call.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-27 04:37:48 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-27 04:37:48 +0000
commite821df4d844ddc286865af359150e45b9ad6c641 (patch)
treeea338a500918a1d1d64a97ad09facc865389ae97 /gcc/ipa-polymorphic-call.c
parent7a7efe05934dafd9a48f5475c35918a2292200d1 (diff)
downloadgcc-e821df4d844ddc286865af359150e45b9ad6c641.tar.gz
* ipa-polymorphic-call.c
(ipa_polymorphic_call_context::get_dynamic_type): Short circuit the case when call target is already known. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223733 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-polymorphic-call.c')
-rw-r--r--gcc/ipa-polymorphic-call.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c
index b69f54184d0..1a82bb7fddb 100644
--- a/gcc/ipa-polymorphic-call.c
+++ b/gcc/ipa-polymorphic-call.c
@@ -1561,6 +1561,11 @@ ipa_polymorphic_call_context::get_dynamic_type (tree instance,
ref = OBJ_TYPE_REF_EXPR (ref);
ref = walk_ssa_copies (ref);
+ /* If call target is already known, no need to do the expensive
+ memory walk. */
+ if (is_gimple_min_invariant (ref))
+ return false;
+
/* Check if definition looks like vtable lookup. */
if (TREE_CODE (ref) == SSA_NAME
&& !SSA_NAME_IS_DEFAULT_DEF (ref)