* ipa-polymorphic-call.c
authorJan Hubicka <hubicka@ucw.cz>
Wed, 27 May 2015 04:37:48 +0000 (06:37 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 27 May 2015 04:37:48 +0000 (04:37 +0000)
(ipa_polymorphic_call_context::get_dynamic_type): Short circuit the
case when call target is already known.

From-SVN: r223733

gcc/ChangeLog
gcc/ipa-polymorphic-call.c

index 39d297d5a2f18fc9fb4e98c4b022265d3390719b..5618d20ccfc14af74f2329e7a6490334a3b37161 100644 (file)
@@ -1,3 +1,9 @@
+2015-05-26  Jan Hubicka  <hubicka@ucw.cz>
+
+       * 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  <olegendo@gcc.gnu.org>
 
        PR target/65979
index b69f54184d076beda22428427ffacc8bb3bdf630..1a82bb7fddb58b5f7787ad9a5848d3ff2df34227 100644 (file)
@@ -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)