From 6acd8c92ef9e9ff26daff5082a16e196b482f340 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 27 May 2015 06:37:48 +0200 Subject: [PATCH] * ipa-polymorphic-call.c (ipa_polymorphic_call_context::get_dynamic_type): Short circuit the case when call target is already known. From-SVN: r223733 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-polymorphic-call.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 39d297d5a2f..5618d20ccfc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-05-26 Jan Hubicka + + * ipa-polymorphic-call.c + (ipa_polymorphic_call_context::get_dynamic_type): Short circuit the + case when call target is already known. + 2015-05-26 Oleg Endo PR target/65979 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) -- 2.30.2