diff mbox

Fix maybe_hot_frequency_p

Message ID 20160529174334.GA10245@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka May 29, 2016, 5:43 p.m. UTC
Hi,
this patch makes maybe_hot_frequency_p to use multiplication instead of division.
This eliminates roundoff errors that are quite serious in this case: 
HOT_BB_FREQUENCY_FRACTION is 1000 while frequencies are scaled from 0...10000.
If there is loop in function then most likely no BB is considered cold. Hopefully
I will get rid of those fixed point arithmetic issues, but lets first fix the
bugs.

Bootstrapped/regtested x86_64-linux, will commit it shortly.

Honza

	* predict.c (maybe_hot_frequency_p): Avoid division.
diff mbox

Patch

Index: predict.c
===================================================================
--- predict.c	(revision 236850)
+++ predict.c	(working copy)
@@ -115,8 +115,8 @@  maybe_hot_frequency_p (struct function *
     return false;
   if (PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION) == 0)
     return false;
-  if (freq < (ENTRY_BLOCK_PTR_FOR_FN (fun)->frequency
-	      / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION)))
+  if (freq * PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION)
+      < ENTRY_BLOCK_PTR_FOR_FN (fun)->frequency)
     return false;
   return true;
 }