[PATCH 4.4] backport builtin_expect cost fix

David Stubbs stubbs@IceraSemi.com
Tue Jan 12 16:35:00 GMT 2010


Hi,

GCC 4.4 is incorrectly calculating the cost of a call to builtin_expect
when inlining small functions. This has been fixed in 4.5, and this
patch backports the fix to 4.4.

Is this ok for 4.4? I don't have write access.

Thanks,
Dave.

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 155838)
+++ ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2010-01-12  David Stubbs  <stubbs@icerasemi.com>
+
+	Backport from mainline:
+	2009-05-12 Jan Hubicka <jh@suse.cz> 	
+	
+	* tree-inline.c (estimate_num_insns): builtin_expect has cost of
0.
+
 2010-01-12  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
 
 	* Backport from mainline
Index: tree-inline.c
===================================================================
--- tree-inline.c	(revision 155838)
+++ tree-inline.c	(working copy)
@@ -2952,8 +2952,7 @@ estimate_num_insns (gimple stmt, eni_wei
 	    case BUILT_IN_CONSTANT_P:
 	      return 0;
 	    case BUILT_IN_EXPECT:
-	      cost = 0;
-	      break;
+              return 0;
 
 	    /* Prefetch instruction is not expensive.  */
 	    case BUILT_IN_PREFETCH:



More information about the Gcc-patches mailing list