cgraph.c (cgraph_propagate_frequency): Do not assume that virtual methods can not...
authorJan Hubicka <jh@suse.cz>
Mon, 26 Aug 2013 15:42:10 +0000 (17:42 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 26 Aug 2013 15:42:10 +0000 (15:42 +0000)
* cgraph.c (cgraph_propagate_frequency): Do not assume that virtual
methods can not be called indirectly when their address is not taken.

From-SVN: r202003

gcc/ChangeLog
gcc/cgraph.c

index 29a8d558588b369acf6f980e59fc1a958649c3ae..f296c376cbcc37d01d0292588c6b9e29018d972a 100644 (file)
@@ -1,3 +1,8 @@
+2013-08-26  Jan Hubicka  <jh@suse.cz>
+
+       * cgraph.c (cgraph_propagate_frequency): Do not assume that virtual
+       methods can not be called indirectly when their address is not taken.
+
 2013-08-26  Jan Hubicka  <jh@suse.cz>
 
        * gimple-fold.c (gimple_get_virt_method_for_binfo): Use ctor_for_folding.
index efd30abb4a0131f3037209287e1b0aef7f8d6afc..063c5245feff31c968f4f37f600515f017850fc8 100644 (file)
@@ -2348,7 +2348,10 @@ cgraph_propagate_frequency (struct cgraph_node *node)
   struct cgraph_propagate_frequency_data d = {true, true, true, true};
   bool changed = false;
 
-  if (!node->local.local)
+  /* We can not propagate anything useful about externally visible functions
+     nor about virtuals.  */
+  if (!node->local.local
+      || (flag_devirtualize && DECL_VIRTUAL_P (node->symbol.decl)))
     return false;
   gcc_assert (node->symbol.analyzed);
   if (dump_file && (dump_flags & TDF_DETAILS))