Do not turn virtual methods cold based on absence of direct calls

Submitted by Jan Hubicka on Aug. 26, 2013, 3:46 p.m.

Details

Message ID 20130826154656.GC6539@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Aug. 26, 2013, 3:46 p.m.
Hi,
on firefox we turn some virtual methods cold just because we think that if they
are not called directly and not having address taken, we won't need them. 
Unless we track call targets of polymorphic calls better, we should not try
to touch them until after inlining (when those will just disappear).

Bootstrapped/regtested x86_64-linux, comitted.

Patch hide | download patch | download mbox

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 202002)
+++ ChangeLog	(working copy)
@@ -1,5 +1,10 @@ 
 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.
 
 2013-08-26  Jan Hubicka  <jh@suse.cz>
Index: cgraph.c
===================================================================
--- cgraph.c	(revision 202000)
+++ cgraph.c	(working copy)
@@ -2348,7 +2348,10 @@  cgraph_propagate_frequency (struct cgrap
   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))