Patch for partial inlining/text.unlikely bug, PR tree-optimization/45781

Steve Ellcey sje@cup.hp.com
Thu Sep 30 10:36:00 GMT 2010


I have had bootstrap problems in IA64 ever since the partial inlining
patch was applied (r161382).  I first reported this in PR44716 and then
later found that the problem was related to the fact that GCC was
putting some code in .text.unlikely (instead of .text) which it never
did before.  This is reported in PR45781.  PR45781 includes a test case
for which this behaviour can be duplicated on x86 as well as IA64 and
probably other platforms as well.

This proposed patch changes compute_function_frequency so that if there
is no branch probabilities or profile info or attributes then a function
is put into the normal text segment by setting node->frequency to
NODE_FREQUENCY_NORMAL instead of not setting at all.

Tested on IA64 HP-UX and Linux and on x86 Linux.

Does this patch seem like the right fix for this problem?

OK to checkin?

Steve Ellcey
sje@cup.hp.com



2010-09-29  Steve Ellcey  <sje@cup.hp.com>

	PR tree-optimization/45781
	PR middle-end/44716
	* predict.c: Set frequency to normal if no overrides.


Index: predict.c
===================================================================
--- predict.c	(revision 164573)
+++ predict.c	(working copy)
@@ -2204,6 +2204,8 @@ compute_function_frequency (void)
       else if (DECL_STATIC_CONSTRUCTOR (current_function_decl)
 	       || DECL_STATIC_DESTRUCTOR (current_function_decl))
         node->frequency = NODE_FREQUENCY_EXECUTED_ONCE;
+      else 
+        node->frequency = NODE_FREQUENCY_NORMAL;
       return;
     }
   node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED;



More information about the Gcc-patches mailing list