This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [pretty-ipa] Merge from trunk


Hi,

On Tue, Mar 23, 2010 at 03:07:06PM +0100, Jan Hubicka wrote:
> > over the weekend I have merged trunk to pretty-ipa (in three or four
> > steps).  The last revision merged was 157640.  The branch bootstraps
> Thanks!
> > but even though it is supposed not to be different from trunk now
> > there are some regressions, including (but not necessarily limited
> > to):
> 
> There is still ipa-profile pass at the branch at least, but I don't
> see how that one can cause those regressions.
> 

At least the failing ipa tests are all caused by the following
difference in predict.c.  IPA-CP can see no hot calls and so performs
no propagation (it refrains from cloning).  It is true that the tests
should probably have the functions declared static.  Are tho following
extra lines in pretty-ipa something we want to have there?

Thanks,

Martin


--- trunk/gcc/predict.c	2009-11-26 16:02:01.000000000 +0100
+++ pipa/gcc/predict.c	2010-03-23 13:58:13.000000000 +0100
@@ -122,6 +122,9 @@
     }
   if (profile_status == PROFILE_ABSENT)
     return true;
+  if (cfun->function_frequency == FUNCTION_FREQUENCY_EXECUTED_ONCE
+      && freq <= (ENTRY_BLOCK_PTR->frequency * 2 / 3))
+    return false;
   if (freq < BB_FREQ_MAX / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION))
     return false;
   return true;
@@ -164,8 +167,21 @@
   if (lookup_attribute ("cold", DECL_ATTRIBUTES (edge->callee->decl))
       || lookup_attribute ("cold", DECL_ATTRIBUTES (edge->caller->decl)))
     return false;
+  if (optimize_size)
+    return false;
   if (lookup_attribute ("hot", DECL_ATTRIBUTES (edge->caller->decl)))
     return true;
+  if (DECL_STRUCT_FUNCTION (edge->caller->decl))
+    {
+      struct function *fun = DECL_STRUCT_FUNCTION (edge->caller->decl);
+      if (fun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED)
+        return false;
+      if (fun->function_frequency == FUNCTION_FREQUENCY_HOT)
+        return true;
+      if (fun->function_frequency == FUNCTION_FREQUENCY_EXECUTED_ONCE
+          && edge->frequency < CGRAPH_FREQ_BASE * 3 / 2)
+	return false;
+    }
   if (flag_guess_branch_prob
       && edge->frequency <= (CGRAPH_FREQ_BASE
       			     / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION)))
@@ -2149,6 +2165,9 @@
 {
   basic_block bb;
 
+  if (cfun->function_frequency == FUNCTION_FREQUENCY_EXECUTED_ONCE)
+    return;
+
   if (!profile_info || !flag_branch_probabilities)
     {
       if (lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl))
@@ -2157,6 +2176,11 @@
       else if (lookup_attribute ("hot", DECL_ATTRIBUTES (current_function_decl))
 	       != NULL)
         cfun->function_frequency = FUNCTION_FREQUENCY_HOT;
+      else if (MAIN_NAME_P (DECL_NAME (current_function_decl)))
+        cfun->function_frequency = FUNCTION_FREQUENCY_EXECUTED_ONCE;
+      else if (DECL_STATIC_CONSTRUCTOR (current_function_decl)
+	       || DECL_STATIC_DESTRUCTOR (current_function_decl))
+        cfun->function_frequency = FUNCTION_FREQUENCY_EXECUTED_ONCE;
       return;
     }
   cfun->function_frequency = FUNCTION_FREQUENCY_UNLIKELY_EXECUTED;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]