Fix function profile computation
diff mbox series

Message ID 20191210180412.qzh6nuzogdics2ua@kam.mff.cuni.cz
State New
Headers show
Series
  • Fix function profile computation
Related show

Commit Message

Jan Hubicka Dec. 10, 2019, 6:04 p.m. UTC
Hi,
this patch fixes compute_function_frequency to work well with profiles
that was downgraded from IPA to local profiles.  

Bootstrapped/regtested x86_64-linux, comitted.

honza

	* predict.c (compute_function_frequency): Check for presence of IPA
	profile.

Patch
diff mbox series

Index: predict.c
===================================================================
--- predict.c	(revision 279167)
+++ predict.c	(working copy)
@@ -3932,13 +3932,11 @@  compute_function_frequency (void)
   if (DECL_STATIC_DESTRUCTOR (current_function_decl))
     node->only_called_at_exit = true;
 
-  if (profile_status_for_fn (cfun) != PROFILE_READ)
+  if (!ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa_p ())
     {
       int flags = flags_from_decl_or_type (current_function_decl);
-      if ((ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa_p ()
-	   && ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa() == profile_count::zero ())
-	  || lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl))
-	     != NULL)
+      if (lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl))
+	  != NULL)
 	{
           node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED;
 	  warn_function_cold (current_function_decl);